Package io.karatelabs.core
Class StepResult
java.lang.Object
io.karatelabs.core.StepResult
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA named report embed, generalised to one-or-moreStepResult.Parts plus optionalmeta(see EXT.md § Embeds).static classOne asset within anStepResult.Embed: either inlinedata(core writes the file and setsfileName) or a report-relativeurl(the ext wrote the asset itself, e.g. underext/image/assets/).static enum -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEmbed(StepResult.Embed embed) voidstatic StepResultstatic StepResultfakeFailure(String message, long startTime, Throwable error) Create a fake failure step result (for @fail tag handling).static StepResultfakeSuccess(String message, long startTime) Create a fake success step result (for @fail tag handling).doublelongAssets attached to this step — screenshots, documents, ext payloads.getError()getLog()The step's captured output — HTTP request / response blocks,print.longgetStep()The display text of a synthetic step (synthetic(java.lang.String, io.karatelabs.core.StepResult.Status, long, java.lang.Throwable)); null for a parsed/hook step.booleanstatic StepResulthook(String hookName, StepResult.Status status, long startTime, long durationNanos, Throwable error) Create a synthetic step result representing a beforeScenario / afterScenario hook.booleanisFailed()booleanisHook()booleanisPassed()booleanstatic StepResultvoidsetCallResults(List<FeatureResult> callResults) voidstatic StepResultstatic StepResultsynthetic(String text, StepResult.Status status, long startTime, Throwable error) Create a synthetic step result that an out-of-band producer appends to a scenario at runtime (not parsed from a.feature).toJson()Convert to JSON format (V1 nested structure).
-
Method Details
-
passed
-
failed
-
skipped
-
fakeSuccess
Create a fake success step result (for @fail tag handling). -
fakeFailure
Create a fake failure step result (for @fail tag handling). -
hook
public static StepResult hook(String hookName, StepResult.Status status, long startTime, long durationNanos, Throwable error) Create a synthetic step result representing a beforeScenario / afterScenario hook. The hook name becomes the step text; nested karate.call() results and logs are set by the caller via the existing setters. -
synthetic
public static StepResult synthetic(String text, StepResult.Status status, long startTime, Throwable error) Create a synthetic step result that an out-of-band producer appends to a scenario at runtime (not parsed from a.feature). UnlikefakeSuccess(java.lang.String, long)/fakeFailure(java.lang.String, long, java.lang.Throwable)— which reuse the log as the step text —textis the step's display text andlog/embeds stay separate and optional. AFAILEDsynthetic step is reported as a failed step row and, becauseScenarioResult.isFailed()scans the step list, fails its scenario without a throw; aPASSEDone is a green step row that does not affect the verdict. The optionalerrorsurfaces as the failed step's message.- See Also:
-
getStep
-
getStatus
-
getStartTime
public long getStartTime() -
getDurationNanos
public long getDurationNanos() -
getDurationMillis
public double getDurationMillis() -
getError
-
getLog
The step's captured output — HTTP request / response blocks,print.Null once the feature has finished, unless the run set
Runner.Builder.retainStepLogs(true). Every report format is generated while the result is still whole; the text is dropped afterwards because aSuiteResultholds every feature for the whole run and this is the bulk of what that costs. SeeFeatureResult.releaseStepLogs(). -
setLog
-
getSyntheticText
The display text of a synthetic step (synthetic(java.lang.String, io.karatelabs.core.StepResult.Status, long, java.lang.Throwable)); null for a parsed/hook step. -
appendLog
-
getEmbeds
Assets attached to this step — screenshots, documents, ext payloads.Null once the feature has finished, unless the run set
Runner.Builder.retainStepLogs(true)— same release, same reason, and these are the larger half because an embed holds raw bytes. SeeFeatureResult.releaseStepLogs(). -
addEmbed
-
getCallResults
-
setCallResults
-
hasCallResults
public boolean hasCallResults() -
getHookName
-
isHook
public boolean isHook() -
isPassed
public boolean isPassed() -
isFailed
public boolean isFailed() -
isSkipped
public boolean isSkipped() -
getErrorMessage
-
toJson
Convert to JSON format (V1 nested structure). Uses nested `step` and `result` objects for V1 compatibility.
-