We have a maven project with a testng.xml file where we have definied our suiteXmlFiles. Below is our testng.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="TestingSuite" parallel="tests" thread-count="2">
<test name="CaseCreationGui">
<classes>
<class name="selenium.CaseCreationGui" />
</classes>
</test> <!-- Test -->
<test name="CaseCreationHeadless">
<classes>
<class name="selenium.CaseCreationHeadless" />
</classes>
</test>
</suite> <!-- Suite -->
In our POM.xml we have added the maven-surefire-plugin in order to execute our Tests. Below is a profile added in our POM.xml:
<profiles>
<profile>
<id>selenium-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<includes>
<include>CaseCreationGui.java</include>
<include>CaseCreationHeadless.java</include>
</includes>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
In order to run our SuiteXMLFile we are running the below command where "selenium-tests" is the profile id defined in POM.
mvn clean test -U -P selenium-tests
The above command is successful.
We have seen in other posts that we can run our SuiteXMLFile by using the below command but unfortunately it is not working for us:
mvn clean test -DsuiteXmlFile=testng.xml
We prefer to use the latter command in order to avoid updating the profiles of the POM.xml frequently whenever we add or remove new Suites.
Any ideas why the above command is not working ? Are we missing something ?
Thank you