Skip to content

Configure generation via YAML

You can provide a YAML config file that mirrors execution options (used by both CLI and Gradle plugin).

Example config

specFile: "openapi.yaml"
outputDir: "./build/generated"
generator: "test-suite-writer"
generatorOptions:
  outputFileName: "openapi-test-suites.json"
  writeMode: "MERGE"
testGenerationSettings:
  maxSchemaDepth: 50
  maxMergedSchemaDepth: 50
  maxSchemaCombinations: 100
  maxTestCasesPerOperation: 1000
  maxErrors: 100
  errorMode: "COLLECT_ALL"
  validSecurityValues:
    ApiKeyAuth: "test-key"
alwaysWriteTests: false
logLevel: "INFO"

Using the config

CLI

openapi-testgen \
  --config-file ./openapi-testgen.yaml \
  --spec-file ./src/test/resources/openapi.yaml

Gradle plugin

openApiTestGenerator {
    configFile.set("openapi-testgen.yaml")
}

Overrides and merge behavior

  • Overrides win over config values.
  • Nested maps are deep-merged; lists/arrays are replaced.

See Distribution settings for defaults and precedence.

Settings reference

Top-level options

Setting Type Required Description
specFile String Yes Path to OpenAPI specification file
outputDir String No Directory for generated artifacts
generator String No Generator id: template or test-suite-writer
generatorOptions Map No Generator-specific options (see below)
testGenerationSettings Object No Core generation settings
alwaysWriteTests Boolean No Write artifacts even on errors (default: false)
logLevel String No Log verbosity: DEBUG, INFO, WARN, ERROR

testGenerationSettings

Setting Type Default Description
maxSchemaDepth Integer 50 Schema traversal depth limit
maxMergedSchemaDepth Integer 50 Composed schema merge depth limit
maxSchemaCombinations Integer 100 Max allOf/anyOf/oneOf combinations
maxTestCasesPerOperation Integer 1000 Max test cases per operation
maxErrors Integer 100 Max errors before stopping
errorMode String COLLECT_ALL FAIL_FAST or COLLECT_ALL
validSecurityValues Map {} Security scheme name to value mapping
ignoreTestCases Map {} Path/method/name patterns to skip
ignoreSchemaValidationRules List [] Rule class names to skip
ignoreAuthValidationRules List [] Auth rule class names to skip

generatorOptions (template generator)

Option Description
templateSet Built-in template set: restassured-java, restassured-kotlin
customTemplateDir Path to custom Mustache templates
templateVariables.package Package name for generated classes
templateVariables.baseUrl Base URL for API requests

generatorOptions (test-suite-writer)

Option Description
outputFileName Output file name (default: derived from spec)
format Output format: json or yaml
writeMode OVERWRITE (default) or MERGE