How to run JUnit tests by category in Maven?

前端 未结 8 1867
说谎
说谎 2020-11-28 21:59

Using JUnit 4.8 and the new @Category annotations, is there a way to choose a subset of categories to run with Maven\'s Surefire plugin?

For example I h

8条回答
  •  离开以前
    2020-11-28 22:21

    Not exactly the same thing but using surefire plugin, test classes can be chosen based on file name. You are not using Junit Categories though.

    An example for running just DAO tests.

    
      
         test-dao
            test
              
                 test
            
              
                 
                    none
                
                                  
                    **/com/proy/core/dao/**/*Test.java
                
            
      
    

    http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html

提交回复
热议问题