Execute selenium webdriver testng.xml using Maven

We can execute our tests using maven Surefire plug-in. This plug-in is used during the test phase of software build lifecycle to execute tests. To configure Surefile Plug-in, we need to add the snippet as below in pom.xml file. And also we need to add TestNG dependency to the pom.xml file.

To get started with TestNG, we need to include the following dependency in our project configuration file Pom.xml

By default, Surefire-plugin runs all tests that matches with filename pattern such as *Test.java in test source directory src/test/java . To use a different naming scheme, we can configure Surefire Plugin which includes parameter and specify the tests that we want to include.

Let us now create a simple example using selenium, testNG and execute with the help of Maven.

Comments

Thank for the such a fantastic website.
I do have a doubt in this topic"Execute selenium webdriver testng.xml using Maven".
I have created a maven project, now how to create testNG.xml? and where to put it in folder

[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>.