CI/CD integration¶
This page is intentionally tool-agnostic: it shows what commands to run in CI to generate tests, but it does not add CI configuration to this repository.
Option A: Gradle plugin (recommended for Gradle builds)¶
- Ensure the plugin is applied and configured (see Gradle integration).
- Run generation as part of your pipeline:
./gradlew generateOpenApiTests
If you want it wired automatically into compilation/resource processing, keep manualOnly=false (default).
Option B: CLI (works in any build)¶
- Build the CLI distribution:
./gradlew :cli:installDist
- Run the generator:
./cli/build/install/openapi-testgen/bin/openapi-testgen --help
See CLI reference for flags.
Tips¶
- Cache Gradle (
~/.gradle) between CI runs when possible. - Keep generation deterministic by pinning inputs (spec, config) and avoiding environment-dependent values.
CI/CD integration¶
This guide shows common CI patterns for running test generation.
Run generation in CI¶
CLI¶
Build and run generation:
./gradlew :cli:installDist
./cli/build/install/openapi-testgen/bin/openapi-testgen --help
Generate artifacts as part of your CI job:
./cli/build/install/openapi-testgen/bin/openapi-testgen \
--spec-file ./path/to/openapi.yaml \
--output-dir ./build/generated-tests \
--generator test-suite-writer \
--generator-option outputFileName=openapi-test-suites.json
Gradle plugin¶
Run:
./gradlew generateOpenApiTests
If you want generation to run only when explicitly invoked, set manualOnly=true in the DSL.
Fail-fast vs best-effort¶
- Use
errorMode=FAIL_FASTfor strict CI. - Use
COLLECT_ALLwhen you prefer collecting multiple errors per run (bounded bymaxErrors).