I get into trouble while I try to run my JUnit test through Gradle test task. While I run the test in eclipse directly with Run As -> JUnit test, everything is ok, the test succeeds. But through test task, test always fails. Probably some trouble with the encoding of my resource txt file. So I would like to enable debug while I am launching the test with Gradle
in build.gradle, my test task now looks like:
test { tasks.withType(Compile) { options.encoding = 'UTF-8' } }
So what should I do to enable debug? I run Gradle tasks from Gradle panel in Eclipse, not from the console. Thanks!
Advertisement
Answer
To debug tests the following argument should be used: --debug-jvm
For example: gradle test --debug-jvm
Gradle will suspend execution right before running tests and wait for debugger connection on port 5005.
For executing only specific tests see Simple name pattern
For additional options see Debugging when running tests.