I have this testng suite segregated under test tag.
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.
We have a way to select single class using this cmd mvn test -Dtest="className"
.
I have tried -Dtestnames=set-5 (http://testng.org/doc/documentation-main.html). but it did not work.
Do we have any way to execute test tag using maven command ?.
I assume you use maven with maven-surefire-plugin to run your tests, right?
Then in the properties section of the plugin add 'testname' with some variable as a value
You can filter your tests by specifying value of the variable
You can use the below command
you can also provide a list of test names in
-testnames
parameterHave a look here