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.
It is used by the CLI and Gradle plugin via the distribution-bundle module.
Depends on¶
modelexample-value
Used by¶
pattern-supportgenerator-templatedistribution-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.
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)
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
SimpleSchemaValidationRuleorAuthValidationRuleand contribute viaTestGenerationModule. 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 values: 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)
API reference¶
- Dokka API reference:
docs/api/core/index.html