Sein3i8
Sein3i8

Reputation: 133

how to execute Testng tests using maven surefire via command line

I have a testng.xml file to bring in parameters into my test software.

<suite name="My suite">
<parameter name="first-name"  value="Cedric"/>
<test name="Simple example">
 <-- ... -->

I would like to know how to run a exclude test while using the testng.xml file via command line only.

 mvn -DexclueTest=!apiXMLTest test

If any packages are needing to be installed or uninstalled this would help.

mvn install -Dmaven.test.skip=false

Maven packages are all up to date.

Upvotes: 0

Views: 396

Answers (2)

user1198289
user1198289

Reputation: 657

I know exactly what you need.

   mvn test -DexcludedGroups=Broken

Then add the tag to your test

 groups = {"con" , "Broken"},

Or if you are using Groovy (Bleh)

 groups = ['con' , 'Broken'],

Yeah Dtest doesnt work do to the xml grouping

Upvotes: 1

user1198289
user1198289

Reputation: 657

It maybe because your are on unix or cmd but try

    mvn -Dtest=!%regex[.*.RESTTest.class#apiXMLTest.*] 
     test

Upvotes: 0

Related Questions