Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

0
how do I pass testng suiteXmlFile name to Maven through command line

Solved 1 Answers 568 Views Test Automation
0 1

Currently I have selenium tests, we are using testng to execute tests. We use "maven-surefire-plugin" to pass testng.xml suite file name. Is there anyway I can pass it through command line so that I can have "suiteXmlFile" name dynamically passed?

 

Here is how my current pom.xml file "maven-surefire-plugin" block looks like.

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>

 

1 Answer

0
Best answer
0

Add the following to the maven-surfire-plugin stanza of your pom.xml:

<suiteXmlFiles>
    <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>

Then you can specify the desired testng suite xml file at the command line:

mvn clean install test -DsuiteXmlFile=testngSuite.xml

Let me know.

answered by (151 points)
selected by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...