Test selection with --tests argument does not appear to work

I am trying to use the 1.10 added feature of specifying tests to run on the command line using the ‘–tests’ argument, but it does not appear to work.

When I run this: ‘/usr/local/Cellar/gradle/1.11/bin/gradle test --tests JdbcConfigTest’, in a project that has a hundred or so test classes, the JdbcConfigTest class does not get run at all. Instead, I only get one test class run, BetterFileUtilsTest. (Included actual class names here just in case that helps debugging purposes). No other class files get run, so some kind of filtering is going on. But, it is not according to the filter I gave it… When I leave off the ‘–tests’ argument, then all the classes get run correctly.

for reference / history, please see https://github.com/gradle/gradle/pull/193


You need to provide fully qualified class name or *JdbcConfigTest

I don’t quite like that. I think we should change it so that you don’t necessarily have to qualify class names.

Is there anything specific about BetterFileUtilsTest? Does it use custom Runner?

Nope. No custom runner. (These are TestNG tests.) It doesn’t extend anything either.

+1 for not requiring a leading asterisk.

Maybe the one special thing about it is that it is the first test class alphabetically in that module. Maybe when there are no matches it defaults to just the first test class?

That’s strange.

Matt, would you be able to create a small sample project that reproduces the issue? It would be extremely helpful.

Hmm, strange indeed. I tried to reproduce with an empty project and couldn’t reproduce it quite yet. Maybe there’s something else strange about our config somewhere…