Package org.mockserver.openapi
Class OpenApiResiliencyTest
- java.lang.Object
-
- org.mockserver.openapi.OpenApiResiliencyTest
-
public class OpenApiResiliencyTest extends Object
Given an OpenAPI spec, generates deliberately malformed and boundary-case requests for each operation, sends them via an injected HTTP-send function, and classifies each outcome as HANDLED (4xx) or UNEXPECTED (5xx, 2xx, or connection error).The class is HTTP-client-agnostic; the caller wires in the real client via the
httpSenderfunction passed torunResiliencyTests(java.lang.String, java.lang.String, java.lang.String, java.util.function.Function<org.mockserver.model.HttpRequest, org.mockserver.model.HttpResponse>).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOpenApiResiliencyTest.Classificationstatic classOpenApiResiliencyTest.MutationResultstatic classOpenApiResiliencyTest.MutationTypestatic classOpenApiResiliencyTest.OperationSummarystatic classOpenApiResiliencyTest.ResiliencyTestReport
-
Constructor Summary
Constructors Constructor Description OpenApiResiliencyTest(MockServerLogger mockServerLogger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OpenApiResiliencyTest.ResiliencyTestReportrunResiliencyTests(String specUrlOrPayload, String baseUrl, String operationIdFilter, Function<HttpRequest,HttpResponse> httpSender)Runs resiliency tests for each operation in the spec.
-
-
-
Constructor Detail
-
OpenApiResiliencyTest
public OpenApiResiliencyTest(MockServerLogger mockServerLogger)
-
-
Method Detail
-
runResiliencyTests
public OpenApiResiliencyTest.ResiliencyTestReport runResiliencyTests(String specUrlOrPayload, String baseUrl, String operationIdFilter, Function<HttpRequest,HttpResponse> httpSender)
Runs resiliency tests for each operation in the spec.- Parameters:
specUrlOrPayload- URL, file path, or inline JSON/YAML of the OpenAPI specbaseUrl- base URL of the service under test (e.g. "http://localhost:8080")operationIdFilter- optional filter to test only a specific operationhttpSender- function that sends an HttpRequest and returns an HttpResponse- Returns:
- structured report with per-mutation results and summary
-
-