TestKit downloading dependencies

The runner executes the test builds in an isolated environment

As it is independent from user’s gradle installation, I was wondering if it downloads the dependencies every time the I run the tests (when the tmp is cleaned up say after a restart)?

By default the TestKit uses a temporary directory as Gradle Home. That is <java.io.tmpdir>/.gradle-test-kit-<username>. Shutting down the test JVM will initiate the deletion of the directory. In turn it will also delete downloaded dependencies.

If you want to use a different, “constant” directory as Gradle Home for test execution, you can use the method GradleRunner.withTestKitDir(File).

I am particularly worried about dependencies like appengineSdk being downloaded again.

Is there a way to tell TestKit GradleRunner to use dependencies from ~/.gradle ?

You could point it there but that would likely mean that existing, environment-specific configuration e.g. gradle.properties is reused (which you probably don’t want to do). If you are providing any other “constant” directory, the download of dependencies would have to happen just once. TestKit would reuse them as they are not deleted after test execution.