Providers¶
Overview¶
Providers generate negative test cases for a single OpenAPI operation. Each provider receives a
TestGenerationContext that includes the parsed spec, the current operation, and a baseline valid
TestCase. Provider execution is orchestrated by ProviderOrchestrator and merged via
OutcomeAggregator (see architecture).
For core entry points and extension context, see the core module. For provider interfaces and extension points, see the Test providers SPI. For user-facing configuration (ignore rules, budgets), see YAML config.
Providers operate at two levels: - Operation-level providers decide which OpenAPI element to target (parameters, request body, auth). - Element-level providers (parameter/request body) apply rules to build invalid values.
All providers are executed inside runProviderSafely, which converts exceptions (including
BudgetExceededException) into Outcome.Failure results with error context.
Default execution order¶
The default order is defined in TestGeneratorConfigurer.createTestSuiteGenerator:
AuthTestCaseProviderForOperationParameterTestCaseProviderForOperationRequestBodyTestCaseProviderForOperation
The order matters for deterministic output ordering in generated test suites.
Provider catalog¶
Operation-level providers¶
AuthTestCaseProviderForOperation- Applies ordered
AuthValidationRuleinstances to generate auth-negative cases. - Skips when neither the operation nor the root OpenAPI document defines security.
-
Expected status codes: 401/403 from built-in auth rules.
-
ParameterTestCaseProviderForOperation - Iterates over operation parameters and invokes parameter providers for each.
- Merges outcomes across parameters and providers.
-
Built-in providers generate
expectedStatusCode = 400cases. -
RequestBodyTestCaseProviderForOperation - Applies request-body providers to the operation request body when present.
- Skips when request body is missing or content is empty after dereference.
- Built-in providers generate
expectedStatusCode = 400cases.
Parameter providers¶
MissedRequiredParameterTestProvider- Generates a case that omits a required query/header/cookie parameter.
-
Path parameters are excluded (always required by design).
-
ParameterSchemaValidationTestProvider - Applies schema validation rules to parameter schemas (including composed schemas).
- Supports query/path/header/cookie parameters.
Request body providers¶
MissedRequiredRequestBodyTestProvider-
Generates a case with a missing required request body.
-
RequestBodySchemaValidationTestProvider - Applies schema validation rules to the request body schema.
- Uses the first supported media type from
Consts.supportedMediaTypes(application/json,application/xml,application/x-www-form-urlencoded).
Negative-case semantics and status codes¶
- Parameter and request body providers generate invalid inputs with
expectedStatusCode = 400. - Auth rules generate
expectedStatusCode = 401or403depending on the rule: - 401 Unauthorized: missing/invalid security values.
- 403 Forbidden: insufficient or incorrect OAuth2/OpenID scopes.
Ignore settings¶
TestGenerationSettings.ignoreSchemaValidationRulesandignoreAuthValidationRulesfilter the rule lists before providers run.TestGenerationSettings.ignoreTestCasesfilters test cases after suite assembly viaIgnoreConfigHandler(path/method/test-case-level filters).
Budget and error handling¶
maxSchemaCombinationslimits composed-schema expansion viaCombinationBudget.maxSchemaDepthlimits recursion for composed rules (array/object traversal).- When provider-level budgets are exceeded, providers return
Outcome.Failurewith aGenerationErrorrather than throwing. maxTestCasesPerOperationis enforced byTestCaseBudgetValidatorin the generator layer and throwsBudgetExceededException.
Extension points¶
Providers are wired explicitly in TestGeneratorConfigurer. To add, remove, or reorder providers,
implement a custom TestSuiteGenerator or supply an alternative wiring layer in a custom engine.
Rules remain the primary extension point via TestGenerationModule.extraSimpleSchemaRules and
extraAuthRules.