Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TestNG surefire, run suite with maven command line

Is it possible to run a predefined xml suite from the command line through maven?

I am able to run a class or a particular test. But I am unable to run a suite.

Here is what I am running from the command line: -->

 mvn -Dtest=TestCircle#mytest -Denvironment=test -Dbrowser=firefox -DscreenShotDirectory=/Users/jeremy/temp test

I do have a suite defined, which runs nicely through intelliJ, but I am not sure how to invoke the suite.xml file.

Or for example, after the tests have run, testng creates a testng-failed file which is setup to run all the failed tests again.

Using mvn, how would I kick off this test suite.

like image 387
fohtoh Avatar asked Apr 30 '12 22:04

fohtoh


1 Answers

This answer gave me what I was looking for, namely the ability to pass at the command line the name of the suite I want to run:

http://www.vazzolla.com/2013/03/how-to-select-which-testng-suites-to-run-in-maven-surefire-plugin/

In a nutshell, 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
like image 103
SkipKent Avatar answered Oct 15 '22 06:10

SkipKent