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

(Matt Hauck) #1

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

(Szczepan Faber) #2


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?

(Matt Hauck) #3

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

(Peter Niederwieser) #4

+1 for not requiring a leading asterisk.

(Matt Hauck) #5

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?

(Szczepan Faber) #6

That’s strange.

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

(Matt Hauck) #7

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…