Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing Exceptions using SenTestingKit/OCUnit

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?

like image 652
Undistraction Avatar asked Sep 28 '11 15:09

Undistraction


1 Answers

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

like image 150
Undistraction Avatar answered Oct 20 '22 02:10

Undistraction