jtanistra / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

Soft assertions #332

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Describe the new feature you have in mind.

It would be great to have possibility to execute "soft" assertions. I mean 
something like verify*() methods in Selenium API.

Which particular problem would this feature solve for you?

It would let me execute a following (next) assertion even if the current one 
fails. E.g. in case when I need to check more than one object attribute value.

Please provide any additional information below. You can also assign labels.

The syntax could be like

expect:
object != null               // standard assertion (a mandatory check)
@Soft object.attributeA == a // soft assertion (I need to know if the 
attributeB has expected value as well)
@Soft object.attributeB == b // soft assertion (I need to know if the 
attributeC has expected value as well)
object.attributeC == c       // standard assertion (the last check never needs 
to be a soft assertion)

I understand that the issue can be solved using complicated helper methods but 
it is not a groovy way, is it?

Original issue reported on code.google.com by krakadzeyau on 8 Oct 2013 at 10:33

GoogleCodeExporter commented 8 years ago
How does a  soft assertion behave when it fails?

Original comment by pnied...@gmail.com on 8 Oct 2013 at 2:18

GoogleCodeExporter commented 8 years ago
If a soft assertion fails, then test execution continues but the test case 
result becomes FAILED (as for regular assertions). And even if all following 
assertions pass common test result remains FAILED.

Original comment by krakadzeyau on 8 Oct 2013 at 4:36