Gradle: Debug Unit Tests

Gradle: Debug Unit Tests

Have you ever been in the situation that everything runs smoothly in your IDE or on your machine and then the build breaks on your command line or CI?

Well, in this case you might want to attach your IDE Debugger and inspect whats going on. This brief article will show you how to do it.

On your local machine you simply tell Gradle to run in debug mode and without the Gradle Daemon. Run your tests using the check task.

gradle --no-daemon -Dorg.gradle.debug=true check

After that you can attach your IDEs Debugger onto port 5005 and see whats actually happening with your test.

Silvio Wangler

Silvio Wangler

Embrach, Switzerland