I have a set of test suites defined in testng.xml file and I am passing an argument from pom.xml file to call the testng file
However I need a solution where I can pass an argument as environment variable to decide which suite I want to execute from testng.xml
My initial thoughts were to have multiple testng.xml files but having multiple files doesnt seem to be the best solution
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="Sanity">
<classes>
<class name="com.ibm.wce.scbn.cc.runner.Sanity" />
</classes>
</test>
</suite>
<suite name="Suite">
<test name="Regression">
<classes>
<class name="com.ibm.wce.scbn.cc.runner.Reg" />
</classes>
</test>
</suite>
Pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<!-- TestNG Suite XML files list for test execution -->
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
VM Argument : mvn clean install -DsuiteXmlFile=testng.xml,testng2.xml