JUnit5 tag-specific gradle task

前端 未结 2 598
一生所求
一生所求 2021-02-04 01:42

I use the following annotation to tag my integration tests:

@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention         


        
2条回答
  •  执笔经年
    2021-02-04 02:01

    I filed an issue: https://github.com/junit-team/junit5/issues/579 (as suggested by Sam Brannen).

    Meanwhile, I am using a project property as a workaround:

    junitPlatform {
        filters {
            tags {
                exclude project.hasProperty('runIntegrationTests') ? '' : 'integration-test'
            }
        }
    }
    

    Consequently, integrations tests will be skipped with:

    gradle test

    but will be included with:

    gradle test -PrunIntegrationTests

提交回复
热议问题