Explain why we would like to run our tests outside of eclipse.
Use Eclipse to execute your tests
We can use the Eclipse to run the tests, via right-click on the test class or method and selecting Run -> Run As -> TestNG Test.
Right-click on the test class will execute all the tests within the class
Right-click on the test method will execute a single test
Use maven to execute your tests
We need a maven plugin to execute our test scripts, called Surefire.
- Open the context menu of the pom file and choose: Maven -> Add Plugin
- Now you can search for ‘maven-surefire-plugin’ and select the latest version
POM.xml file and add the following XML snippet between the
<build><plugins> ... </plugins></build> tags:
<plugin><groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.15</version> </plugin>
Now you are able to execute your tests by maven