How to use JUnit 5 @Tag with IntelliJ and Maven

后端 未结 2 429
孤街浪徒
孤街浪徒 2020-12-12 02:38

I would like to use the @Tag available in JUnit 5 in order to easily filter my tests.

I have found in this blog input from September 2016 that IntelliJ

2条回答
  •  渐次进展
    2020-12-12 03:14

    Now it is possible with Intellij IDEA 2018.1, take a look at this answer for details (including screenshot).


    Also, you can see Build Support with Maven in JUnit official documentation for a proper configuration of maven-surefire-plugin. The section Filtering by Tags can be especially useful to filter tests by tags.

    Example (excluding all tests with the "integration" tag):

    ...
    
        
            ...
            
                maven-surefire-plugin
                2.21.0
                
                    
                        integration
                    
                
                
                    
                        org.junit.platform
                        junit-platform-surefire-provider
                        1.2.0
                    
                    ...
                
            
        
    
    ...
    

提交回复
热议问题