Search in sources :

Example 1 with TestStepResult

use of io.cucumber.messages.types.TestStepResult in project cucumber-jvm by cucumber.

the class TestStep method emitTestStepFinished.

private void emitTestStepFinished(TestCase testCase, EventBus bus, UUID textExecutionId, Instant stopTime, Duration duration, Result result) {
    bus.send(new TestStepFinished(stopTime, testCase, this, result));
    TestStepResult testStepResult = new TestStepResult();
    if (result.getError() != null) {
        testStepResult.setMessage(extractStackTrace(result.getError()));
    }
    testStepResult.setStatus(from(result.getStatus()));
    testStepResult.setDuration(javaDurationToDuration(duration));
    Envelope envelope = new Envelope();
    envelope.setTestStepFinished(new io.cucumber.messages.types.TestStepFinished(textExecutionId.toString(), id.toString(), testStepResult, javaInstantToTimestamp(stopTime)));
    bus.send(envelope);
}
Also used : TestStepResult(io.cucumber.messages.types.TestStepResult) TestStepFinished(io.cucumber.plugin.event.TestStepFinished) Envelope(io.cucumber.messages.types.Envelope)

Example 2 with TestStepResult

use of io.cucumber.messages.types.TestStepResult in project cucumber-jvm by cucumber.

the class TestCase method emitTestCaseFinished.

private void emitTestCaseFinished(EventBus bus, UUID executionId, Instant stop, Duration duration, Status status, Result result) {
    bus.send(new TestCaseFinished(stop, this, result));
    TestStepResult testStepResult = new TestStepResult();
    testStepResult.setStatus(from(status));
    testStepResult.setDuration(javaDurationToDuration(duration));
    if (result.getError() != null) {
        testStepResult.setMessage(toString(result.getError()));
    }
    Envelope envelope = new Envelope();
    envelope.setTestCaseFinished(new io.cucumber.messages.types.TestCaseFinished(executionId.toString(), javaInstantToTimestamp(stop), false));
    bus.send(envelope);
}
Also used : TestStepResult(io.cucumber.messages.types.TestStepResult) TestCaseFinished(io.cucumber.plugin.event.TestCaseFinished) Envelope(io.cucumber.messages.types.Envelope)

Aggregations

Envelope (io.cucumber.messages.types.Envelope)2 TestStepResult (io.cucumber.messages.types.TestStepResult)2 TestCaseFinished (io.cucumber.plugin.event.TestCaseFinished)1 TestStepFinished (io.cucumber.plugin.event.TestStepFinished)1