Skip to content

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.

  1. Ensure the plugin is applied and configured (see Gradle integration).
  2. 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)

  1. Build the CLI distribution:
./gradlew :cli:installDist
  1. 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_FAST for strict CI.
  • Use COLLECT_ALL when you prefer collecting multiple errors per run (bounded by maxErrors).