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

前端 未结 12 2029
花落未央
花落未央 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 06:55

    
        
            
                org.apache.maven.plugins
                maven-compiler-plugin
                3.0
                
                    ${java.version}
                    ${java.version}
                
            
            
            
                org.apache.maven.plugins
                maven-surefire-plugin
                2.10
                
                    true
                
            
            
        
    
    
    
        
        
        
            junit-tests
            
                
                    
                        org.apache.maven.plugins
                        maven-surefire-plugin
                        2.10
                        
                            false
                        
                        
                            
                                org.apache.maven.surefire
                                surefire-junit47
                                2.10
                            
                        
                    
                
            
        
    
        
        
            testNG-tests
            
                
                    
                        org.apache.maven.plugins
                        maven-surefire-plugin
                        2.10
                        
                            false
                        
                    
                
            
        
    
        
    
    

    Than just run: mvn test -Pjunit-tests (for run test based on junit) or mvn test -PtestNG-tests (for TestNG test based).

提交回复
热议问题