Reputation:
I am using "testng" framework and "maven" to run my tests from command line.
I want to run tests in all browsers for which we need to configure testng.xml for all browsers(which I have done)
However I want to run specific tests in all browsers.Is there a way to achieve this?
I know for running specific tests in single browser we use maven commands like below:
mvn -Dtest=TestFile test
However it is not possible to specify both testng and -Dtest together like:
mvn -DsuiteXmlFiles="mytestng.xml" -Dtest="MyTest" test
(Also, pom.xml cannot take multivalue parameters) Please suggest something for this case
Upvotes: 1
Views: 284
Reputation: 14746
The easiest way of getting this done is to by an implementation of org.testng.IAnnotationTransformer
within which you can get the value that was passed via -Dtest
using System.getProperty("test")
as the method to be executed. Now within the transform()
method, you disable every other method apart from the one that was passed via -Dtest
Upvotes: 1