TestNG surefire, run suite with maven command line

前端 未结 3 1095
情话喂你
情话喂你 2021-01-04 22:34

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.

3条回答
  •  [愿得一人]
    2021-01-04 23:37

    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:

    
        ${suiteXmlFile}
    
    

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

    mvn clean install test -DsuiteXmlFile=testngSuite.xml
    

提交回复
热议问题