Package io.karatelabs.core
Class FeatureResult
java.lang.Object
io.karatelabs.core.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.intlonglongintintintintintlongbooleanisEmpty()booleanisFailed()booleanisPassed()voidPrint a summary of this feature's results to the console.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() -
isPassed
public boolean isPassed() -
isFailed
public boolean isFailed() -
isEmpty
public boolean isEmpty() -
getDurationMillis
public long getDurationMillis() -
getDisplayName
-
getFailureMessage
-
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.
-