Execute your test

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.

  1. Open the context menu of the pom file and choose: Maven -> Add Plugin
  2. Now you can search for ‘maven-surefire-plugin’ and select the latest version


Open the POM.xml file and add the following XML snippet between the <build><plugins> ... </plugins></build> tags:

<version>2.15</version> </plugin>

Now you are able to execute your tests by maven

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.