Class ScenarioResult

java.lang.Object
io.karatelabs.core.ScenarioResult
All Implemented Interfaces:
Comparable<ScenarioResult>

public class ScenarioResult extends Object implements Comparable<ScenarioResult>
  • Field Details

    • EXPECT_TEST_TO_FAIL_BECAUSE_OF_FAIL_TAG

      public static final String EXPECT_TEST_TO_FAIL_BECAUSE_OF_FAIL_TAG
      See Also:
  • Constructor Details

    • ScenarioResult

      public ScenarioResult(Scenario scenario)
  • Method Details

    • setStartTime

      public void setStartTime(long startTime)
    • setEndTime

      public void setEndTime(long endTime)
    • setThreadName

      public void setThreadName(String threadName)
    • isAborted

      public boolean isAborted()
    • setAborted

      public void setAborted(boolean aborted)
    • getScenario

      public Scenario getScenario()
    • getStepResults

      public List<StepResult> getStepResults()
    • addStepResult

      public void addStepResult(StepResult sr)
    • getStartTime

      public long getStartTime()
    • getEndTime

      public long getEndTime()
    • getThreadName

      public String getThreadName()
    • isPassed

      public boolean isPassed()
    • isFailed

      public boolean isFailed()
    • isSkipped

      public boolean isSkipped()
      True when this scenario was aborted via karate.abort() or had no step pass and no step fail (suite-aborted pre-run or empty scenario). Reported additively alongside isPassed(); a skipped scenario is still counted as passed (preserves existing count semantics). Surfaces in reports via a synthetic @skipped tag.
    • getDurationMillis

      public long getDurationMillis()
    • getDurationNanos

      public long getDurationNanos()
    • getFailureMessage

      public String getFailureMessage()
    • getFailedStepLocation

      public String 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

      public String 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

      public Throwable 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

      public Map<String,Object> toJson()
      Convert to JSON format. Used for HTML reports, JSONL streaming, and report aggregation.
    • compareTo

      public int compareTo(ScenarioResult other)
      Specified by:
      compareTo in interface Comparable<ScenarioResult>