On Travis my tests repeatedly fail because of org.gradle.launcher.daemon.client.DaemonDisappearedExceptions.
I tried using GradleRunner.withArguments('--no-daemon'), but that’s not allowed. How can I prevent TestKit from using daemon mode?
Thanks for the tip.
There is one problem though: When I turn debug mode on, I can’t access GradleRunner.build().output anymore (throws org.gradle.testkit.runner.UnsupportedFeatureException). Is this supposed to be like that? Then this workaround doesn’t help me very much…
You will need to use Gradle version >= 2.9 for testing your code to be able to inspect build output while running in debug mode. Please see the TestKit documentation for potential limitations.
I would have expected that the GradleRunner respects an environment setting like GRADLE_OPTS="-Dorg.gradle.daemon=false", but apparently that’s not the case
I wanted to turn off the Gradle daemon, because it keeps running out of Metaspace when running multiple tests in one class (probably a leak in one of the plugins I use). I found a hacky workaround to make sure each test runs in it’s own Daemon. Not exactly what OP was looking for, but might help someone.