Module: core¶
core is the generation engine: it parses OpenAPI, builds per-operation test suites using providers and rules, applies budgets/filters, and emits artifacts through generators.
Depends on¶
modelexample-value
Used by¶
pattern-supportgenerator-templatedistribution-bundle
Key entry points¶
TestGenerationEngine: public facade used by CLI, Gradle plugin, and embedding codeTestGeneratorExecutionOptionsFactory: merges YAML config with CLI/Gradle overridesTestGenerationSettings: typed generation settings (budgets, ignore config, error handling)GeneratorIds: stable ids (template,test-suite-writer)- Built-in generator:
test-suite-writer(JSON/YAML writer)
Extension points¶
- Rules: implement
SimpleSchemaValidationRule/AuthValidationRuleand contribute viaTestGenerationModule - Generators: implement
ArtifactGeneratorFactoryand contribute viaTestGenerationModule - Schema values: provide
SchemaValueProviderimplementations viaTestGenerationModule
API reference¶
- Local Dokka output:
docs/api/openapi.testgen.core/index.html
Related docs¶
- Concepts:
- Test generation flow
- Provider-rule model
- Reference:
- Distribution settings
- Rules catalog
- Providers catalog
- API reference
- How-to:
- Test-suite-writer
- Template generator
- Ignore rules
Core module¶
Overview¶
core is the deterministic engine that parses OpenAPI specs, generates TestSuite objects per operation, and delegates to artifact generators to produce outputs.
It is used by the CLI and Gradle plugin via the distribution-bundle module.
Dependencies¶
- Depends on:
model,example-value - Used by:
generator-template,pattern-support,distribution-bundle
Responsibilities¶
- Parse and resolve OpenAPI documents.
- Build a baseline valid
TestCaseper operation. - Apply providers and rules to derive negative test cases.
- Enforce budgets and deterministic ordering.
- Produce a
GenerationReportand run artifact generators.
Key packages¶
config/: execution options, settings, merge semantics, module wiring.generation/: suite generation orchestration and context.generation/orchestration/: provider execution and outcome aggregation.providers/: operation and element-level test case providers.rules/: schema/auth validation rules plus composed rules.testdata/: valid-case construction, basic/security values, example extraction helpers.generator/: artifact generator registry and built-in generator wiring.generator/writer/: JSON/YAML test suite writer implementation.
Determinism and budgets¶
The core is designed to be deterministic:
- Provider execution order is fixed (auth → parameters → request body).
- Rules are sorted deterministically (fully-qualified class name; composed rules appended after simple rules).
- Output ordering is stable and merge behavior is deterministic.
Budget controls prevent combinatorial explosion:
maxSchemaDepth/maxMergedSchemaDepthcap recursion.maxSchemaCombinationslimits allOf/anyOf/oneOf expansion viaCombinationBudget.maxTestCasesPerOperationis enforced byTestCaseBudgetValidator.
Configuration¶
Core behavior is configured primarily via TestGenerationSettings (budgets, ignore filters, example value settings, and module-owned settings).
See: YAML config and Distribution settings.
Extension points¶
- Rules: implement
SimpleSchemaValidationRuleorAuthValidationRule. See: SPI and rules catalog. - Providers: implement
TestCaseProvider<T>. See: SPI and providers catalog. - Generators: implement
ArtifactGeneratorFactoryandArtifactGenerator. See: test-suite-writer generator and the generator SPI docs. - Schema value providers: implement
SchemaValueProviderinexample-valueand contribute via aTestGenerationModule. See: example-value module. - Module settings: implement
ModuleSettingsExtractorto parse module-specific settings fromtestGenerationSettings.
Testing and fixtures¶
- Unit tests:
core/src/test/kotlin - Fixtures/snapshots:
core/src/test/resources - Run:
./gradlew :core:test(or./gradlew :core:check)
Related documentation¶
- Concepts: architecture
- How-to: ignore rules
- How-to: test-suite-writer generator
- Reference: distribution settings