如何在testng套件中的单个测试标签下运行一组类?
我将这个testng套件隔离在测试标签下.
I have this testng suite segregated under test tag.
这是其他问题的不同术语( TestNG surefire,运行套件使用maven命令行).在这里,我需要在测试标签下执行一组类,而不是特定的类或特定的包.
This is different interms of other issues (TestNG surefire, run suite with maven command line). Here I need to execute set of classes under test tag not specific class nor specific package.
<suite name="Suite1" verbose="1" >
<test name="set-1" >
<classes>
<class name="com.test.ejb.AdminServiceTest" />
....
</classes>
</test>
<test name="set-2">
<classes>
<class name="com.test.ejb.ServiceTestBase" />
...
</classes>
</test>
<test name="set-3">
<classes>
<class name="com.test.ejb.RazakIeraTest" />
...
</classes>
</test>
<test name="set-4">
<classes>
<class name="com.test.ejb.PayCheckTest" />
...
</classes>
</test>
</suite>
我有一个带有在测试标签下的一组类的套件.我只想执行一个测试标签.
I have a suite with a grouping of classes under test tag. I would like to execute only one test tag.
我们有一种方法可以使用此cmd mvn test -Dtest="className"
选择单个类.
We have a way to select single class using this cmd mvn test -Dtest="className"
.
我尝试了-Dtestnames = set-5( http://testng.org/doc /documentation-main.html ).但这没用.
I have tried -Dtestnames=set-5 (http://testng.org/doc/documentation-main.html). but it did not work.
我们是否可以使用maven命令执行测试标签?
Do we have any way to execute test tag using maven command ?.
我假定您将maven与maven-surefire-plugin一起使用来运行测试,对吧?
I assume you use maven with maven-surefire-plugin to run your tests, right?
然后在插件的属性部分添加'testname',并将某些变量作为值
Then in the properties section of the plugin add 'testname' with some variable as a value
<properties>
<property>
<name>testnames</name>
<value>${testng.testnames}</value>
</property>
</properties>
您可以通过指定变量的值来过滤测试
You can filter your tests by specifying value of the variable
mvn test -Dtestng.testnames=set-1,set-2