Gradle integration¶
Use the Gradle plugin when you want generation wired into your build instead of running the CLI separately.
1) Apply the plugin¶
See Version placeholders for where to look up <version>.
2) Configure generation¶
Minimal template-generator setup:
openApiTestGenerator {
specFile.set("src/test/resources/openapi.yaml")
outputDir.set(layout.buildDirectory.dir("generated/openapi-tests"))
generator.set("template")
generatorOptions.putAll(
mapOf(
"templateSet" to "restassured-java",
"templateVariables" to mapOf(
"package" to "com.example.generated",
"baseUrl" to "http://localhost:8080",
),
)
)
}
Minimal JSON/YAML writer setup:
openApiTestGenerator {
specFile.set("src/test/resources/openapi.yaml")
outputDir.set(layout.buildDirectory.dir("generated/openapi-tests"))
generator.set("test-suite-writer")
generatorOptions.put("outputFileName", "test-suites.json")
}
3) Run generation¶
Default wiring:
templateoutput is added to the test source settest-suite-writeroutput is wired into test resources
4) Disable automatic wiring when needed¶
Use manualOnly when you want to control task ordering or consume generated output from a custom location.
Next steps¶
- Generators for generator-specific options
- Distribution settings for defaults and settings semantics
- Gradle plugin reference for the full DSL surface