Home > Blockchain >  Include / exclude tests by fully qualified package name
Include / exclude tests by fully qualified package name

Time:10-21

I'm trying to specify a set of tests by fully qualified package name, using Maven 3.6.3 with maven-surefire-plugin 3.0.0-M5 on OpenJDK 11. The documentation states...

As of Surefire Plugin 2.19.1, the syntax with fully qualified class names or packages can be used

...and goes on to give an example:

<include>my.package.*, another.package.*</include>

If I have my test class Test1.java in a package called some.test.pkg1 and use:

<include>some.test.pkg1.*</include>

or even:

<include>some.test.*</include>

...the test won't be executed. Why is that?


Update 1: To provide all the infos requested by @khmarbaise, I've pushed a small project to github, please see here: https://github.com/zb226/so69604251-maven-surefire-plugin


Update 2: @ori-dar suggested dropping the asterisk * (or .*), but it does not help.


Update 3: I found mentions that by default Maven expects to have Test classes' names ending with Test, so I tried to rename the test to MavenTest.java, which didn't help either.


Update 4: For posterity, SUREFIRE-1789 seems to deal with this exact issue. SUREFIRE-1389 is related. SUREFIRE-1191 introduced the corresponding section in the docs.

CodePudding user response:

To be honest, this looks like a bug in maven-surefire-plugin, or at best some behavior change that isn't documented properly.

I took the sample you posted to GitHub, downgraded it to maven-surefire-plugin 2.19.1, and it works just fine.

You may want to report this bug Apache's Jira.

  • Related