You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have read CONTRIBUTING and have done my best to follow them.
What did you do?
We currently have a very large test suite (several thousands of Specs) that uses Cedar which is not really maintained anymore. Due to the very similar API we try to migrate all specs from Cedar to Quick but would like to still use the Doubles and Matchers of Cedar. Unfortunately the Cedar Matchers throw NSExceptions instead of letting the current test case fail. This is not a big problem since Quick continues to execute examples. However, as soon as a test fails due to an exception no afterEach block of the corresponding example is executed. This sometimes leads to a situation where following tests are executed in an unclean state so that they fail even though they would have been successful when the previous test didn't throw an exception. This often happens when we spy a class using start_spying_on([Some class]) that has to be unspied in afterEach.
What did you expect to happen?
afterEach blocks are still executed when an example fails due to an exception.
I've made a few tests using a variation of the ObjC class from this StackOverflow discussion where I could handle NSException like a swift Error, so the afterEach blocks were still executed.
I can prepare a PR with this but one thing comes to my mind. If NSException is treated as a usual try/catch block, wouldn't we be in a false sense of security for having the afterEach blocks being executed, but the system would actually be in a non-deterministic error state? Should we just abort the whole error suite?
What did you do?
We currently have a very large test suite (several thousands of Specs) that uses Cedar which is not really maintained anymore. Due to the very similar API we try to migrate all specs from Cedar to Quick but would like to still use the Doubles and Matchers of Cedar. Unfortunately the Cedar Matchers throw
NSException
s instead of letting the current test case fail. This is not a big problem since Quick continues to execute examples. However, as soon as a test fails due to an exception noafterEach
block of the corresponding example is executed. This sometimes leads to a situation where following tests are executed in an unclean state so that they fail even though they would have been successful when the previous test didn't throw an exception. This often happens when we spy a class usingstart_spying_on([Some class])
that has to be unspied inafterEach
.What did you expect to happen?
afterEach
blocks are still executed when an example fails due to an exception.What actually happened instead?
No
afterEach
block is executed.Environment
List the software versions you're using:
Project that demonstrates the issue
Download zip file here
The text was updated successfully, but these errors were encountered: