user1494328
user1494328

Reputation: 681

Few TestNG classes, how to run all tests by one 'click'?

I'm new in TestNG. In my project I have a few TestNG classes and I want to run methods of each classes by one 'click'. Do anyone know how to do it? I use Eclipse Indigo.

Thanks.

Upvotes: 2

Views: 3586

Answers (1)

Ashutosh Jindal
Ashutosh Jindal

Reputation: 18869

This should be useful. You could create a TestNG suite, include all the tests in that and then run the Suite in a single click.

<suite name="My test suite">
  <test name="testing">
    <classes>
       <class name="TestNGTest1" />
       <class name="TestNGTest2" />
    </classes>
  </test>
</suite>

Once you have created the above suite, you can create a TestNG launch configuration. Select the Run / Run... (or Run / Debug...) menu and create a new TestNG configuration:

enter image description here

If you do not have the TestNG plugin installed, you can do so by following the official TestNG-For-Eclipse guide here.

And finally, for the One-Click-Joy, if you mark this Launch Configuration as a Favorite in the Common tab of the launch Configuration :

enter image description here

Once, you do that, this launch configuration shall be available in the Eclipse Toolbar :

enter image description here

Upvotes: 6

Related Questions