Package org.mockserver.load
Class LoadScenarioReport
java.lang.Object
org.mockserver.load.LoadScenarioReport
Builds an end-of-run summary report for a load scenario from a single
LoadScenarioOrchestrator.LoadScenarioStatus snapshot (the live snapshot for a running run, or the retained terminal
snapshot for a finished one).
Two equivalent renderings are produced from the same data:
toJson(LoadScenarioStatus)— a machine-readable JSON document (built with the sharedObjectMapperFactorymapper) carrying counts, latency percentiles, the threshold verdict and per-threshold results.toJUnitXml(LoadScenarioStatus)— a JUnit-XML<testsuite>so a load run becomes a first-class CI artifact: one<testcase>per threshold (a breach produces a<failure>), plus arun completedtestcase that fails on an error-caused terminal state or anabortOnFailabort. p95/p99/error-rate are surfaced as<properties>.
The XML is hand-built and XML-escaped (no new dependency) so a scenario name containing
& < > " ' is rendered safely.
The report is derived purely from existing LoadScenarioOrchestrator.LoadScenarioStatus fields; it adds no new
tracking to the hot path.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleError rate for a run: failed requests as a fraction of the requests that have actually completed (failed / max(1, succeeded + failed)).static booleanTrue when the run is in a terminal state that should be treated as a CI failure: it was aborted by anabortOnFailthreshold breach, it carries aFAILverdict, or it stopped while having recorded request failures.static StringBuild the JSON summary report for a run.static StringBuild the JUnit-XML summary report for a run.
-
Method Details
-
errorRate
Error rate for a run: failed requests as a fraction of the requests that have actually completed (failed / max(1, succeeded + failed)). The denominator is the completed count, not requestsSent, so an in-flight (dispatched-but-not-yet-completed) request — which can exist in a snapshot taken while the run is still draining — never dilutes the rate as if it were a success. A run with no completed request reports 0 rather than dividing by zero. This matches the ERROR_RATE threshold metric computed inLoadScenarioOrchestrator.evaluateThresholds. -
runFailed
True when the run is in a terminal state that should be treated as a CI failure: it was aborted by anabortOnFailthreshold breach, it carries aFAILverdict, or it stopped while having recorded request failures. A clean COMPLETED/STOPPED run with no failures is a pass. -
toJson
Build the JSON summary report for a run. -
toJUnitXml
Build the JUnit-XML summary report for a run. The suite has one testcase per threshold plus arun completedtestcase; breached thresholds and a failed run carry a<failure>.
-