gradle
8.4

# withTestKitDir

abstract fun withTestKitDir(testKitDir: File): GradleRunner(source)

Sets the directory to use for TestKit's working storage needs.

This directory is used internally to store various files required by the runner. If no explicit Gradle user home is specified via the build arguments (i.e. the `-g «dir»` option}), this directory will also be used for the Gradle user home for the test build.

If no value has been specified when the build is initiated, a directory will be created within a temporary directory.

- When executed from a Gradle Test task, the Test task's temporary directory is used (see getTemporaryDir).
- When executed from somewhere else, the system's temporary directory is used (based on `java.io.tmpdir`).

This directory is not deleted by the runner after the test build.

You may wish to specify a location that is within your project and regularly cleaned, such as the project's build directory.

It can be set using the system property `org.gradle.testkit.dir` for the test process,

The actual contents of this directory are an internal implementation detail and may change at any time.

#### Return

`this`

#### Parameters

testKitDir

the TestKit directory