Is there a way to tell surefire to skip tests in a certain package?

前端 未结 3 605
慢半拍i
慢半拍i 2020-11-29 07:11

Something like the following.

I would like a way to skip my dao tests in surefire. Trying to avoid overhead of defining Suites.

With CI I\'d like to have on

3条回答
  •  青春惊慌失措
    2020-11-29 07:53

    It is possible to exclude tests using the commandline; using ! to exclude.

    Note: I'm not sure but possibly needs 2.19.1 or later version of surefire to work.

    Examples:

    This will not run TestHCatLoaderEncryption

    mvn install '-Dtest=!TestHCatLoaderEncryption'
    

    Exclude a package:

    mvn install '-Dtest=!org.apache.hadoop.**'
    

    This can be combined with positive filters as well. The following will run 0 tests:

    mvn install '-Dtest=Test*CatLoaderEncryption,!TestHCatLoaderEncryption'
    

    See the Maven Surefire docs.

提交回复
热议问题