runner
Instantiates a GradleRunner in dir.
Examples
test("Create the root build.gradle.kts file") {
gradle.rootProject.buildKts("""
tasks.register("print") {
doLast {
println("Configuring the project")
}
}
""".trimIndent()
val result = gradle.runner()
.withPluginClasspath()
.withArguments("print")
.build()
result.output shouldContain "Configuring the project"
}
Content copied to clipboard
See also
GradleRunner.withPluginClasspath
When writing tests for a plugin, automatically adds it to the executed Gradle instance
GradleRunner.withArguments
Specify which tasks should be executed
GradleRunner.build
Executes the build, expecting a success
GradleRunner.buildAndFail
Executes the build, expecting a failure