Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
4.9k views
in Test Automation by The go-to Tester (181 points)

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 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer

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.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...