Skip to content

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

  • model
  • example-value

Used by

  • pattern-support
  • generator-template
  • distribution-bundle

Key entry points

  • TestGenerationEngine: public facade used by CLI, Gradle plugin, and embedding code
  • TestGeneratorExecutionOptionsFactory: merges YAML config with CLI/Gradle overrides
  • TestGenerationSettings: 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 / AuthValidationRule and contribute via TestGenerationModule
  • Generators: implement ArtifactGeneratorFactory and contribute via TestGenerationModule
  • Schema values: provide SchemaValueProvider implementations via TestGenerationModule

API reference

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 TestCase per operation.
  • Apply providers and rules to derive negative test cases.
  • Enforce budgets and deterministic ordering.
  • Produce a GenerationReport and 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 / maxMergedSchemaDepth cap recursion.
  • maxSchemaCombinations limits allOf/anyOf/oneOf expansion via CombinationBudget.
  • maxTestCasesPerOperation is enforced by TestCaseBudgetValidator.

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 SimpleSchemaValidationRule or AuthValidationRule. See: SPI and rules catalog.
  • Providers: implement TestCaseProvider<T>. See: SPI and providers catalog.
  • Generators: implement ArtifactGeneratorFactory and ArtifactGenerator. See: test-suite-writer generator and the generator SPI docs.
  • Schema value providers: implement SchemaValueProvider in example-value and contribute via a TestGenerationModule. See: example-value module.
  • Module settings: implement ModuleSettingsExtractor to parse module-specific settings from testGenerationSettings.

Testing and fixtures

  • Unit tests: core/src/test/kotlin
  • Fixtures/snapshots: core/src/test/resources
  • Run: ./gradlew :core:test (or ./gradlew :core:check)