spockframework / spockframework/spock
Test failures should show the block the failure was in
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 483
- PR merge metrics
- No merged PRs in 30d
Description
I've been looking through the various extension methods, and it doesn't appear that any of them expose which block contained the failure. For instance, given this test:
def "Test that failure occurs"() {
given: "i equals zero"
def i = 0
when: "i is incremented by 1"
i++
then: "i should be equal to 1"
i == 0
}
There is no way to report that the then block labeled i is equal to 1 was what failed. Since Spock makes the behavior of these blocks somewhat self-explanatory, it would be nice to be able to generate an easy to read report of test failures containing the block names that caused the failure.
There should be a way to retrieve this information. Ideally, this would baked into the ErrorInfo object so IRunListener implementations can get access to it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the ErrorInfo object and IRunListener extension points to see how test failures are represented and reported. Done means listeners can retrieve the failing Spock block's label, such as the then block in the example, through the failure information.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100