Package io.karatelabs.core
Class ScenarioResult
java.lang.Object
io.karatelabs.core.ScenarioResult
- All Implemented Interfaces:
Comparable<ScenarioResult>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidApply @fail tag logic: invert the pass/fail result.intcompareTo(ScenarioResult other) longlonglonggetError()intGet the failed step location for IDE navigation.Get the failure message with feature file path and line number for display.intintlongbooleanbooleanisFailed()booleanbooleanisPassed()booleanTrue when this scenario was aborted viakarate.abort()or had no step pass and no step fail (suite-aborted pre-run or empty scenario).voidsetAborted(boolean aborted) voidsetEndTime(long endTime) voidsetStartTime(long startTime) voidsetThreadName(String threadName) toJson()Convert to JSON format.
-
Field Details
-
EXPECT_TEST_TO_FAIL_BECAUSE_OF_FAIL_TAG
- See Also:
-
-
Constructor Details
-
ScenarioResult
-
-
Method Details
-
setStartTime
public void setStartTime(long startTime) -
setEndTime
public void setEndTime(long endTime) -
setThreadName
-
isAborted
public boolean isAborted() -
setAborted
public void setAborted(boolean aborted) -
getScenario
-
getStepResults
-
addStepResult
-
getStartTime
public long getStartTime() -
getEndTime
public long getEndTime() -
getThreadName
-
isPassed
public boolean isPassed() -
isFailed
public boolean isFailed() -
isSkipped
public boolean isSkipped()True when this scenario was aborted viakarate.abort()or had no step pass and no step fail (suite-aborted pre-run or empty scenario). Reported additively alongsideisPassed(); a skipped scenario is still counted as passed (preserves existing count semantics). Surfaces in reports via a synthetic@skippedtag. -
getDurationMillis
public long getDurationMillis() -
getDurationNanos
public long getDurationNanos() -
getFailureMessage
-
getFailedStepLocation
Get the failed step location for IDE navigation. Format: "path/to/feature.feature:LINE" (standard IDE clickable format) Uses absolute path when available for better IDE compatibility.- Returns:
- location string "path:line", or null if no failure
-
getFailureMessageForDisplay
Get the failure message with feature file path and line number for display. Format: "path/to/feature.feature:LINE step text"- Returns:
- formatted failure message, or null if no failure
-
getError
-
getPassedCount
public int getPassedCount() -
getFailedCount
public int getFailedCount() -
getSkippedCount
public int getSkippedCount() -
applyFailTag
public void applyFailTag()Apply @fail tag logic: invert the pass/fail result. If the scenario failed (as expected with @fail), mark it as passed. If the scenario passed (unexpectedly with @fail), mark it as failed. -
isFailTagApplied
public boolean isFailTagApplied() -
toJson
Convert to JSON format. Used for HTML reports, JSONL streaming, and report aggregation. -
compareTo
- Specified by:
compareToin interfaceComparable<ScenarioResult>
-