Distribution settings (CLI + Gradle plugin)
Both the CLI and Gradle plugin ship the same "distribution" wiring from distribution-bundle.
They use TestGenerationRunner.withDefaults, which applies shared defaults and then merges
user configuration and overrides.
Default wiring
Modules
TemplateGeneratorModule (template generator)
PatternSupportModule (pattern-based values and rules)
PatternModuleSettingsExtractor reads testGenerationSettings.patternGeneration
into PatternGenerationOptions.
Default settings
DistributionDefaults.settings() inserts the pattern provider before plain-string in
the example-value provider order, so pattern-based example generation is enabled by default.
Configuration sources and precedence
- YAML config file (
configFile) is loaded with GeneratorConfigLoader.
- CLI flags or Gradle properties are applied as overrides (
TestGeneratorOverrides).
- Overrides win over config values; missing values fall back to defaults.
Module settings extraction happens before core settings parsing, so patternGeneration
is available when modules are created.
Top-level settings
| Setting |
CLI |
Gradle |
Type |
Required |
Description |
| Config file |
--config-file |
configFile |
String |
No |
YAML base config path |
| Spec file |
--spec-file |
specFile |
String |
Yes |
OpenAPI specification file path |
| Output dir |
--output-dir |
outputDir |
String |
No |
Output directory for generated artifacts |
| Generator id |
--generator |
generator |
String |
No |
Generator: template or test-suite-writer |
| Generator options |
--generator-option |
generatorOptions |
Map |
No |
Generator-specific options |
| Always write tests |
--always-write-test |
alwaysWriteTests |
Boolean |
No |
Write artifacts even on errors (default: false) |
| Log level |
--log-level |
logLevel |
String |
No |
DEBUG, INFO, WARN, ERROR |
testGenerationSettings
Core settings for test case generation behavior.
Budget controls
| Setting |
Type |
Default |
Description |
maxSchemaDepth |
Integer |
50 |
Maximum depth of schema validation traversal |
maxMergedSchemaDepth |
Integer |
50 |
Maximum depth when merging composed schemas (allOf/anyOf/oneOf) |
maxSchemaCombinations |
Integer |
100 |
Maximum schema combinations per parameter/property |
maxTestCasesPerOperation |
Integer |
1000 |
Maximum test cases generated per operation |
maxErrors |
Integer |
100 |
Maximum errors to collect before stopping |
errorMode |
String |
COLLECT_ALL |
FAIL_FAST (stop on first error) or COLLECT_ALL |
Security
| Setting |
Type |
Default |
Description |
validSecurityValues |
Map<String, String> |
{} |
Security scheme name to valid value mapping |
Example:
testGenerationSettings:
validSecurityValues:
ApiKeyAuth: "my-api-key"
BearerAuth: "Bearer eyJ..."
Ignore configuration
| Setting |
Type |
Default |
Description |
ignoreTestCases |
Map |
{} |
Path/method/test case patterns to skip |
ignoreSchemaValidationRules |
Set<String> |
[] |
Fully qualified rule class names to skip |
ignoreAuthValidationRules |
Set<String> |
[] |
Fully qualified auth rule class names to skip |
Example:
testGenerationSettings:
ignoreTestCases:
"/internal/*":
"*": [ "*" ] # Skip all tests for /internal/ paths
"/pets/{petId}":
"GET": [ "Invalid*" ] # Skip "Invalid*" tests for GET
ignoreSchemaValidationRules:
- "art.galushko.openapi.testgen.rules.schema.OutOfMinimumLengthStringSchemaValidationRule"
Basic test data overrides
| Setting |
Type |
Default |
Description |
overrideBasicTestData |
Map<String, String> |
{} |
Override values for basic test data provider methods |
testGenerationSettings.exampleValues
Configuration for schema-derived example value generation.
| Setting |
Type |
Default |
Description |
providers |
List<String> |
See below |
Ordered provider list; first match wins |
maxExampleDepth |
Integer |
10 |
Maximum recursion depth for example generation |
Default provider order:
providers:
- enum
- const
- uuid
- email
- date
- date-time
- pattern # Added by distribution (before plain-string)
- plain-string
- number
- boolean
Provider-specific settings
uuid
| Setting |
Type |
Default |
Description |
template |
String |
"uuid-%s" |
Template with %s placeholder for variation index |
email
| Setting |
Type |
Default |
Description |
template |
String |
"email%[email protected]" |
Template with %s placeholder |
date
| Setting |
Type |
Default |
Description |
startDate |
String |
"2020-01-01" |
Start date in ISO-8601 format (YYYY-MM-DD) |
dateTime
| Setting |
Type |
Default |
Description |
startDate |
String |
"2020-01-01" |
Start date in ISO-8601 format |
timeSuffixTemplate |
String |
"T%02d:00:00Z" |
Time suffix template with %s for hour |
plainString
| Setting |
Type |
Default |
Description |
validChars |
String |
"abcdefghij..." |
Characters allowed in generated strings |
Example:
testGenerationSettings:
exampleValues:
providers:
- enum
- const
- pattern
- plain-string
maxExampleDepth: 15
uuid:
template: "test-uuid-%s"
email:
template: "test%[email protected]"
date:
startDate: "2024-01-01"
testGenerationSettings.patternGeneration
Configuration for regex pattern-based value generation (provided by pattern-support module).
| Setting |
Type |
Default |
Description |
defaultMinLength |
Integer |
3 |
Default minimum length when not specified by schema |
spaceChars |
String |
" \t\f\n\r\u00a0" |
Characters matching \s in patterns |
anyPrintableChars |
String |
null |
Characters matching .; null uses library default |
Example:
testGenerationSettings:
patternGeneration:
defaultMinLength: 5
spaceChars: " \t"
Generator options
template generator
| Option |
Type |
Description |
templateSet |
String |
Built-in template set: restassured-java, restassured-kotlin |
customTemplateDir |
String |
Path to custom Mustache templates |
templateVariables |
Map |
Variables passed to templates |
templateVariables.package |
String |
Package name for generated classes |
templateVariables.baseUrl |
String |
Base URL for API requests |
Example:
generator: template
generatorOptions:
templateSet: restassured-java
templateVariables:
package: com.example.generated
baseUrl: http://localhost:8080
test-suite-writer generator
| Option |
Type |
Default |
Description |
outputFileName |
String |
Derived from spec |
Output file name |
format |
String |
json |
Output format: json or yaml |
writeMode |
String |
OVERWRITE |
OVERWRITE or MERGE |
Example:
generator: test-suite-writer
generatorOptions:
format: json
writeMode: MERGE
outputFileName: test-suites.json
Gradle-only settings
| Setting |
Type |
Default |
Description |
manualOnly |
Boolean |
false |
Disable automatic source set wiring and task dependencies |
Complete YAML example
specFile: "src/test/resources/openapi.yaml"
outputDir: "./build/generated/openapi-tests"
generator: "template"
generatorOptions:
templateSet: restassured-java
templateVariables:
package: com.example.generated
baseUrl: http://localhost:8080
testGenerationSettings:
# Budget controls
maxSchemaDepth: 50
maxMergedSchemaDepth: 50
maxSchemaCombinations: 100
maxTestCasesPerOperation: 1000
maxErrors: 100
errorMode: COLLECT_ALL
# Security
validSecurityValues:
ApiKeyAuth: "test-api-key"
BearerAuth: "Bearer test-token"
# Ignore configuration
ignoreTestCases:
"/health":
"*": [ "*" ]
ignoreSchemaValidationRules: [ ]
ignoreAuthValidationRules: [ ]
# Example value settings
exampleValues:
providers:
- enum
- const
- uuid
- email
- date
- date-time
- pattern
- plain-string
- number
- boolean
maxExampleDepth: 10
# Pattern generation (from pattern-support module)
patternGeneration:
defaultMinLength: 3
alwaysWriteTests: false
logLevel: INFO