The --tests filter doesn't seem to work as documented, at least with groovy

Per the documentation it seems that:

gradle test --tests SomeSpecificTest

Would run the test class named org.package.SomeSpecificTest, or any class with that name. However I couldn’t get that to ever run any tests, because of the package name. So the following did evaluate what I thought it would

gradle test --tests *SomeSpecificTest

I am not sure if the first was intended to work like the second. Either way is valid, but should be either corrected in the docs, or gradle should be fixed to match the docs.

This was happening for me with gradle 1.11 and the java and groovy plugin on a groovy test.

Thanks!

Hi Timothy,

Can you please point me to the exact documentation you were looking at.

http://www.gradle.org/docs/current/userguide/java_plugin.html#sec:java_test

In section “23.12.2. Test filtering”

I can’t see anything in there that implies that it would work without the wildcard, as it matches on fully qualified class names.

I would say these two both fail:

gradle test --tests SomeTest.someSpecificFeature

gradle test --tests SomeSpecificTest

Those two lines should be:

gradle test --tests *SomeTest.someSpecificFeature

gradle test --tests *SomeSpecificTest

Even the filter page has the wildcard:

includeTestsMatching “*SomeTest.someSpecificFeature”

I think we should get rid of the requirement to use a leading asterisk. It’s too cumbersome, and too easy to get wrong.