Not ignore it completely, just have it not stop execution if it hits an Assert and it fails. I would like to see a summary of all the fails at the end.
views:
37answers:
3Functions in the Assert class will throw an AssertFailedException when an Assert operation fails. Therefore, execution won't continue unless that exception is handled, which you shouldn't be doing in a unit test.
It's a good thing that you are only shown the one failed assert at a time. You can fix the problem and then rerun the test, fix the next fail and so on until the test is passing and then safely go back and refactor the code.
A unit test should only have one Assert statement (and it must have an Assert statement). A unit test should only test one thing.
If you refactor your test into many tests, each with a single assert, you will get the result you desire.
It sounds like you're running tests with the debugger attached, and it's pausing execution of the test run because of the AssertFailedException
. If you run the tests without the debugger, it should complete the run and give you the summary.
That said, if you're talking about a single test with multiple asserts then no, you can't do this: the failed assert is an exception and will terminate the current test.