Configure generation via YAML¶
You can provide a YAML config file that mirrors execution options (used by both CLI and Gradle plugin).
The config filename is arbitrary; examples use openapi-testgen.yaml.
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¶
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.
Config schema (overview)¶
Top-level keys you’ll typically use:
specFile(required)outputDir(required)generator(required):templateortest-suite-writergeneratorOptions(optional): generator-specific optionstestGenerationSettings(optional): core generation settings (budgets, filters, security values, example generation)alwaysWriteTests(optional)logLevel(optional)
For the authoritative list of keys, defaults, and precedence rules, see Distribution settings.
Generator options¶
generatorOptions is generator-specific.
See Generator options for supported keys and exact behavior.
Common next steps¶
- Target a subset of endpoints: Include operations
- Provide credentials for auth schemes: Security values
- Exclude noisy endpoints/cases: Ignore rules
- Add the valid (2xx) baseline case: Positive testing
Related docs¶
- Budget controls - Tuning budget limits
- CLI reference - Flags and nested
--setting/--generator-optionsyntax - Gradle plugin reference - DSL fields and task wiring