Closed
Description
Hi,
I ran into an issue with chained assertions. Apparently the test only fails when the last Should in the chain fails:
TestScope "ChainedAssertions" {
Describing "and" {
Given "There are chained assertions"{
It "fails on the first failed assertion"{
@('a','b','c') | Should Count 2 and | Should Contain 'b' -test
}
It "fails on the last failed assertion"{
@('a','b','c') | Should Count 3 and | Should Contain 'z' -test
}
}
}
}
This seems to be caused by $result being overwritten each time the Should method is executed. As a quickfix the if(!$result)
statement at the end of the Should function would need to be evaluated before chaining.
The nicer fix would be to allow $result to hold multiple values, one for each should. This would allow executing all assertions, while the quickfix only reveals one bug at a time.
Metadata
Metadata
Assignees
Labels
No labels