Skip to content

Include positive test cases

By default, the generator produces only negative test cases that validate error handling (4xx responses). To also test that valid requests succeed with 2xx responses, enable the includeValidCase option.

Configuration

YAML

testGenerationSettings:
    includeValidCase: true

CLI

openapi-testgen --setting includeValidCase=true ...

Gradle

openApiTestGenerator {
    testGenerationSettings {
        includeValidCase.set(true)
    }
}

What you get

Enabling includeValidCase adds a single baseline positive test case (named "Test Valid Case") to each generated suite. The expected status code is derived from the first 2xx response defined in the OpenAPI spec for the operation.

See: Distribution settings → Output options