How do I control which tests to run in testng from ant?

流过昼夜 提交于 2019-12-12 20:56:22

问题


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.



来源:https://stackoverflow.com/questions/5915766/how-do-i-control-which-tests-to-run-in-testng-from-ant

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!