spockframework / spockframework/spock

Spock Soft Assertions ( verifyall() ) does not work with Power Asserts, AssertThat from AssertJ, etc

Open
#855 9 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component:docs
Dominant language
Java
Stars
3.6k
Forks
483
PR merge metrics
No merged PRs in 30d

Description

veryifyAll {

    assert a == b
    assert x == y

}

The second assert will not be reached.
It is the same issues if you use assertJ assertThat, or use assert that() from hamcrest.
If you just use that() without the "assert" in front it works as expected

Here is a snippet of a example i am working with:

  @Unroll
  def "Message Events Check: External Implementation"(){
    expect:
      verifyAll {
        that(event['implementation']['topic'], notNullValue())
        that(event['eventId'], notNullValue())
        that(event['eventName'], notNullValue())
      }
   where:
   event << model.getMessageEvents().findAll { it['implementation']['camundaType'] == 'external'}
}

If you add "assert" in front of the that() assert that() only the first assertion will function

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior around verifyAll with plain assert statements, AssertJ assertThat, and Hamcrest assertions, using the examples in the issue. Trace how verifyAll handles assertion failures and compare it with calls that omit the assert keyword. Done means all assertions in the block are evaluated and failures are reported together.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.