robospock / RoboSpock

A testing framework which brings powers of Spock and Groovy to Android app testing
http://robospock.org
MIT License
249 stars 44 forks source link

Can't run a single spec with gradle? #69

Closed walid-halabi-myob closed 7 years ago

walid-halabi-myob commented 7 years ago

So I've tried ./gradlew -Dtest.single=SomeSpec and it runs all the tests.

I've also tried ./gradlew -DtestSomeVarient=SomeSpec, as well as ./gradlew -Dtest.com.some.package.SomeSpec (and the various combinations of these 2 approaches) and still no 🎲

Any ideas? I have a feeling I got this working about a year ago but there's no docs that help.

Opalo commented 7 years ago

@walid-halabi-myob it should be doable as describe here: https://stackoverflow.com/questions/31344419/gradle-run-only-one-test-suite/31370966#31370966

walid-halabi-myob commented 7 years ago

Wow that was fast, thanks for the answer.

I tried this with both gradle 2.8 (what we were using) and gradle 3.3, and both give me:

Unknown command-line option '--tests'.

Not sure when this command line option was available? I'm thinking it comes in via a plugin, but not sure which?

walid-halabi-myob commented 7 years ago

For anyone coming later, this works: ./gradlew testDebug --tests com.package.ClassOfSpec

Note the use of the variant testDebug. just using the test task fails with the Unknown command-line option error

Also, using the -Dtest.single system property method has been superseded by the test filtering approach (--tests) as above.