Package io.karatelabs.core
Interface RunListener
- All Known Subinterfaces:
Ext
- All Known Implementing Classes:
JsonLinesEventWriter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Unified listener interface for runtime events.
Replaces the separate RuntimeHook and ResultListener interfaces with a single, consistent API.
Usage example:
Suite.of("features/")
.listener(event -> {
switch (event.getType()) {
case SCENARIO_ENTER -> {
System.out.println("Starting: " + event.getScenarioRuntime().getScenario().getName());
}
case STEP_EXIT -> {
StepResult sr = event.getStepResult();
if (sr != null invalid input: '&'invalid input: '&' sr.isFailed()) {
System.out.println("Step failed: " + event.getStep().getText());
}
}
}
return true;
})
.run();
Thread safety: Events are fired on different threads during parallel execution. Implementations must be thread-safe - avoid shared mutable state or use proper synchronization.
-
Method Summary
-
Method Details
-
onEvent
Called for all runtime events.- Parameters:
event- the event containing type, runtime objects, and results- Returns:
- true to continue execution, false to skip (only meaningful for *_ENTER events)
-