cucumber / cucumber/common

First class representation of assertion errors in reporting

Open
#2,298 5 comments 0 reactions 1 assignee Claimed by @davidjgoss View on GitHub
Dominant language
No language data
Stars
3.4k
Forks
679
PR merge metrics
No merged PRs in 30d

Description

Currently one get the following message for a (failed) test_step_finished

```
test_step_finished {
test_step_result {
status: FAILED
message: "org.opentest4j.AssertionFailedError: expected: <8.0> but was: <3.0>\n\tat org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)\n\tat org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)\n\tat org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)\n\tat org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)\n\tat org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1124)\n\tat io.cucumber.examples.java.RpnCalculatorSteps.the_result_is(io/cucumber/examples/java/basic_arithmetic.feature:27)\n"
duration {
nanos: 2984000
}
}
timestamp {
seconds: 1619766696
nanos: 398493000
}
test_step_id: "c2692c18-91e6-4a38-8cd8-c40ef71ca67e"
test_case_started_id: "22500d5c-fb17-464a-8f7e-8afa01342e58"
}
```

to prevent the consumer from parsing the message is would be good to have the 'expected: <8.0> but was: <3.0>' part split in different fields

**Describe the solution you'd like**
```
test_step_finished {
test_step_result {
status: FAILED
expected: "<8.0>",
actual: "<3.0>",
message: "org.opentest4j.AssertionFailedError: expected: <8.0> but was: <3.0>\n\tat org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)\n\tat org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)\n\tat org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)\n\tat org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)\n\tat org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1124)\n\tat io.cucumber.examples.java.RpnCalculatorSteps.the_result_is(io/cucumber/examples/java/basic_arithmetic.feature:27)\n"
duration {
nanos: 2984000
}
}
timestamp {
seconds: 1619766696
nanos: 398493000
}
test_step_id: "c2692c18-91e6-4a38-8cd8-c40ef71ca67e"
test_case_started_id: "22500d5c-fb17-464a-8f7e-8afa01342e58"
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.