Class FeatureResult
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic FeatureResultfromException(Feature feature, Throwable error, long startTime) Create a failed FeatureResult from an exception that occurred during feature execution.intlonglongintThe Gherkin comment above the failed step (the assertion label), or null when there is none.intThe failed step's line number, or -1 when there is no failure or the failure is not tied to a parsed step (hook / synthetic).The failed step'spath/to/feature.feature:LINE step text, or null when there is no failure.The failure reason without the Gherkin comment label, or null when there is no failure.The one-line "why" of the failure, e.g.intintPass rate as an integer percentage 0–100, or null when no scenarios executed.intintlongbooleanisEmpty()booleanisFailed()booleanisPassed()voidPrint a summary of this feature's results to the console.voidprintSummary(boolean dryRun) voidDrop the nestedkarate.call()result trees hanging off this feature's steps.voidDrop each step's captured log text and embedded assets, once every consumer has had them.voidsetCallArg(Object callArg) voidsetCallDepth(int callDepth) voidsetEndTime(long endTime) voidsetLoopIndex(int loopIndex) voidsetResultVariables(Map<String, Object> resultVariables) voidsetStartTime(long startTime) voidSort scenario results by section index, example index, and line number.toJson()Convert to JSON format.
-
Constructor Details
-
FeatureResult
-
-
Method Details
-
fromException
Create a failed FeatureResult from an exception that occurred during feature execution. This is used when an unexpected error prevents normal scenario execution, such as failures in dynamic expression evaluation for Scenario Outlines.- Parameters:
feature- the feature that failederror- the exception that caused the failurestartTime- the start time of the feature execution- Returns:
- a FeatureResult marked as failed with a synthetic scenario containing the error
-
getFeature
-
setStartTime
public void setStartTime(long startTime) -
setEndTime
public void setEndTime(long endTime) -
getStartTime
public long getStartTime() -
getEndTime
public long getEndTime() -
getCallDepth
public int getCallDepth() -
setCallDepth
public void setCallDepth(int callDepth) -
getLoopIndex
public int getLoopIndex() -
setLoopIndex
public void setLoopIndex(int loopIndex) -
getCallArg
-
setCallArg
-
getResultVariables
-
setResultVariables
-
addScenarioResult
-
getScenarioResults
-
sortScenarioResults
public void sortScenarioResults()Sort scenario results by section index, example index, and line number. This ensures deterministic ordering in reports regardless of parallel execution order. -
getScenarioCount
public int getScenarioCount() -
getPassedCount
public int getPassedCount() -
getFailedCount
public int getFailedCount() -
getSkippedCount
public int getSkippedCount() -
getPassedRate
Pass rate as an integer percentage 0–100, or null when no scenarios executed. Denominator ispassedCount + failedCount— mirrors the HTML report's per-feature calc so JSONL consumers and the HTML view agree. -
isPassed
public boolean isPassed() -
releaseCallResults
public void releaseCallResults()Drop the nestedkarate.call()result trees hanging off this feature's steps.Every call attaches the callee's entire
FeatureResultto the callingStepResult, and aSuiteResultholds every feature for the whole run — so without this the live set grows with total scenarios times calls per scenario, and a long suite exhausts the heap on retention alone rather than on anything it is actually doing.Called once a feature has completed and every listener has consumed it, so the HTML report — which extracts its page model synchronously — keeps full nested step detail. What is lost is the ability to walk into a called feature's steps from a
SuiteResultafter the run;Runner.Builder.retainCallResults(true)keeps that for callers who need it.Only the nesting is dropped. Each step's own status, timing, log and embeds are untouched, so summaries, failure messages and the report itself are unaffected.
-
releaseStepLogs
public void releaseStepLogs()Drop each step's captured log text and embedded assets, once every consumer has had them.This is the bulk of what a suite retains. The log holds the rendered HTTP request and response for every step — bodies included — and an
StepResult.Embedholds rawbyte[], which for a UI suite means a screenshot per failed step. Both are kept only so the report writers can render them, yet aSuiteResultholds every feature until the run ends, so they stay reachable for hours after the last thing that reads them. Measured on a 350,000-scenario soak with all four report formats on: ~3.2 KB retained per scenario, of which roughly 70% was this text — and that share grows with payload size, which is why a suite of scenarios making several calls with large bodies is where this stops being footprint and becomes an OOM.Called from the same place as
releaseCallResults()and under the same precondition — afteronFeatureEnd, so HTML, Cucumber JSON and JUnit XML have all serialized the feature, and afterFEATURE_EXIT, where the JSONL stream carriestoJson()(non-JSON embeds having already been externalized toembeds/bySuite.fireEvent, so the record carries file references). Nothing downstream reads either field later; what is lost is the ability to inspect a step's log or embeds from aSuiteResultafter the run, whichRunner.Builder.retainStepLogs(true)keeps for callers who need it.Status, timing, failure messages and counts are untouched, so summaries, the console output and every report are unaffected.
-
isFailed
public boolean isFailed() -
isEmpty
public boolean isEmpty() -
getDurationMillis
public long getDurationMillis() -
getDisplayName
-
getFailureMessage
-
getFailureMessageForDisplay
The failed step'spath/to/feature.feature:LINE step text, or null when there is no failure. SeeScenarioResult.getFailureMessageForDisplay(). -
getFailureReason
The failure reason without the Gherkin comment label, or null when there is no failure. SeeScenarioResult.getFailureReason(). -
getFailureReasonSummary
The one-line "why" of the failure, e.g."match failed: EQUALS", or null when there is no failure. SeeScenarioResult.getFailureReasonSummary(). -
getFailedStepComment
The Gherkin comment above the failed step (the assertion label), or null when there is none. SeeScenarioResult.getFailedStepComment(). -
getFailedStepLine
public int getFailedStepLine()The failed step's line number, or -1 when there is no failure or the failure is not tied to a parsed step (hook / synthetic). Lets a caller that already knows the feature path — the Gatling executor logs the path exactly as the simulation declared it — append:LINEwithout swapping in the absolute path. -
toJson
Convert to JSON format. Used for HTML reports, JSONL streaming, and report aggregation. -
printSummary
public void printSummary()Print a summary of this feature's results to the console. -
printSummary
public void printSummary(boolean dryRun) - Parameters:
dryRun- parse-only (-D) — every scenario is skipped and skips count towardpassed, so the status word must say "parsed", not "passed".
-