le0nidas
le0nidas

Reputation: 77

Android Studio 3 does not run tests in Spock

I updated Android Studio to version 3 and since then all my spock tests, when in a java module, do not run when trying to run them from inside the application (right click on groovy folder -> Run 'Tests in groovy'). I get a:

Class not found: "package.name.classname"Empty test suite."

Same if I try to run a single test.

If I run the test task from the gradle panel I get this: error. Cause: unknown.


On the other hand:


My setup:


A few things I tried after searching in both google and here:

Upvotes: 7

Views: 747

Answers (1)

Troy Patrick
Troy Patrick

Reputation: 300

So this is more of a workaround than an actual solution but it should give you your debugger back which is probably 90% of the value anyway:

You can run your test suite like:

./gradlew <module>:test --debug-jvm

And the jvm running your tests will suspend until a debugger attaches.

From Android Studio bring up the action chooser by pressing ctrl + shift + a (on linux anyway, check the equivalent for your OS) and select:

Attach to local process...

Once Android Studio attaches the tests will begin running.

The --debug-jvm flag can be used together with --tests to debug an individual test:

./gradlew <module>:test --tests fully.qualified.test.Test --debug-jvm

Upvotes: 3

Related Questions