TestNG surefire, run suite with maven command line

前端 未结 3 1115
情话喂你
情话喂你 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条回答
  •  梦毁少年i
    2021-01-04 23:20

    Usually you don't need nothing special in relationship with TestNG. Just use the maven-surefire-plugin:

      
        org.apache.maven.plugins
        maven-surefire-plugin
        2.12
      
    

    and based on that all Tests which are correctly annotated should run. Ah of course you need a dependency to TestNG like this:

    
      org.testng
      testng
      6.5.2
      test
    
    

    Usually i wouldn't create Test Suites anymore, cause this a point which you have to maintain which is often missed to update etc. just use annotations.

    If you need to run a particular suite of tests just define a testng.xml file in src/test/resources and enhance the configuration of the maven-surefire plugin appropriately.

      
        org.apache.maven.plugins
        maven-surefire-plugin
        2.12
        
          
            src/test/resources/testng.xml
          
        
      
    

提交回复
热议问题