Testing Exceptions using SenTestingKit/OCUnit
Asked Answered
D

1

6

The only solution I seem to be able to find for testing for exceptions is using SenTestingKit's STAssertThrows and STAssertThrowsSpecific, however in both cases when the exception is thrown the application under test hangs until I manually ask it to continue. Surely the exceptions should be swallowed by the testing framework? And if not, does anyone have a beter suggestion for testing exceptions?

Demeanor answered 28/9, 2011 at 15:13 Comment(0)
D
5

I was going to delete this question, but here is the solution for anyone else who finds themselves in a the same situation:

The reason that the application was breaking was that I had an Exception Breakpoint set up. This breaks as soon as an exception is raised, not when it bubbles up, so it was actually being halted before it had even got as far as my assertion. I just need to toggle off breakpoints (or just the exception breakpoint) when I am running tests.

enter image description here

Demeanor answered 28/9, 2011 at 15:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.