Module: distribution-bundle¶
distribution-bundle is the shared "product layer" used by both the CLI and the Gradle plugin. It bundles feature modules and exposes a stable execution entry point.
Depends on¶
coregenerator-templatepattern-support
Used by¶
cliplugin
Key entry points¶
TestGenerationRunner¶
Runs a generation end-to-end with configurable modules and reporting:
- Merges config + overrides into
TestGeneratorExecutionOptions - Extracts module settings (e.g., pattern generation options)
- Creates modules via a
ModuleFactory - Generates a
GenerationReport - Writes artifacts when generation succeeds or
alwaysWriteTestsis set
Use withDefaults(reporter) for standard wiring or the builder for customization.
Programmatic invocation (Kotlin)¶
This snippet runs generation using the same defaults as the CLI/Gradle plugin (withDefaults) and passes inputs via TestGeneratorOverrides.
import art.galushko.openapi.testgen.config.TestGeneratorOverrides
import art.galushko.openapi.testgen.distribution.Slf4jReporter
import art.galushko.openapi.testgen.distribution.TestGenerationRunner
import org.slf4j.LoggerFactory
import java.nio.file.Path
fun main() {
val runner = TestGenerationRunner.withDefaults(
reporter = Slf4jReporter(LoggerFactory.getLogger("openapi-testgen"))
)
val overrides = TestGeneratorOverrides(
specFile = "openapi.yaml",
outputDir = Path.of("build/generated"),
generatorId = "test-suite-writer",
generatorOptions = mapOf(
"format" to "json",
"outputFileName" to "test-suites.json",
),
)
runner.execute(config = null, overrides = overrides)
}
Add dependency:
See Version placeholders for how to choose <version>.
TestGenerationReporter¶
Output abstraction allowing environment-specific logging:
- CLI uses
Slf4jReporterwhich delegates formatting to coreConsoleReporter - Gradle uses a logger adapter that routes to
project.logger
DistributionDefaults¶
Factory for standard modules, settings, and extractors:
- Modules:
TemplateGeneratorModule,PatternSupportModule - Extractors:
PatternModuleSettingsExtractor - Settings: inserts provider id
patternbeforeplain-stringin example-value order
Extending the distribution¶
For embedding/integration scenarios, prefer:
TestGenerationRunner.builder()to add modules or custom reportersTestGenerationEngine(fromcore) if you want finer control over orchestration
API reference¶
- Dokka API reference:
docs/api/distribution-bundle/index.html
Related docs¶
- Concepts: Architecture
- How-to:
- Custom modules
- Custom generators
- Modules:
- Core module
- Pattern support