Class FeatureResult

java.lang.Object
io.karatelabs.core.FeatureResult

public class FeatureResult extends Object
  • Constructor Details

    • FeatureResult

      public FeatureResult(Feature feature)
  • Method Details

    • fromException

      public static FeatureResult fromException(Feature feature, Throwable error, long startTime)
      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 failed
      error - the exception that caused the failure
      startTime - the start time of the feature execution
      Returns:
      a FeatureResult marked as failed with a synthetic scenario containing the error
    • getFeature

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

      public Object getCallArg()
    • setCallArg

      public void setCallArg(Object callArg)
    • getResultVariables

      public Map<String,Object> getResultVariables()
    • setResultVariables

      public void setResultVariables(Map<String,Object> resultVariables)
    • addScenarioResult

      public void addScenarioResult(ScenarioResult sr)
    • getScenarioResults

      public List<ScenarioResult> 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()
    • isPassed

      public boolean isPassed()
    • isFailed

      public boolean isFailed()
    • isEmpty

      public boolean isEmpty()
    • getDurationMillis

      public long getDurationMillis()
    • getDisplayName

      public String getDisplayName()
    • getFailureMessage

      public String getFailureMessage()
    • toJson

      public Map<String,Object> 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.