How to execute JUnit and TestNG tests in same project using maven-surefire-plugin?

前端 未结 12 1999
花落未央
花落未央 2020-12-13 06:04

Right now I have both type of tests but when I say \"mvn test\" it only executes TestNG tests and not Junit. I want to execute both one after another. Any Idea ?

12条回答
  •  旧巷少年郎
    2020-12-13 07:00

    I have a better solution.

    The idea is to create two executions of the maven-surefire-plugin, one for JUnit, one for TestNG. You can disable one of TestNG or JUnit per execution by specifying nonexisting junitArtifactName or testNGArtifactName:

    
        org.apache.maven.plugins
        maven-surefire-plugin
        
            
                test
                
                    test
                
                 
                    none:none
                
            
            
                test-testng
                test
                
                    test
                
                 
                    none:none
                
            
        
    
    

提交回复
热议问题