How do I control which tests to run in testng from

2019-07-21 09:23发布

问题:

In build.xml: the testng target has attributes like "testname" and "suitename". But these do not seem to activate or deactivate the corresponding tests or suites within the testng.xml file

Is this the right way to use these?

How can I control which tests or suites are run from within build.xml that references testng.xml?

Thanks.

回答1:

I found this post to solve a similar problem:

http://www.nullin.com/2009/12/23/running-single-test-or-class-using-testng-and-ant/

As long as you can fit whichever parameters you want in the template (or make them replaceable), you can get most of the benefits from both approaches.



回答2:

You can't select a testng.xml and tell TestNG which tests to pick from that testng.xml. Use a different testng.xml file to do that.

The command line and ant/maven allow you to do some rudimentary selection too, but then you can't specify a testng.xml.



标签: ant testng