How can I test NSAssert cases using the iPhone Unit Testing platform

(Suppose I have good reason not to delete my NSAssert () checks in my code just because I also do unit testing.)

In my unit testing module, I would like to make sure that NSAssert in my code gets (approves) when I call it. Therefore, I use the STAssertThrows () macro when invoking code that makes this statement.

The problem is this: despite the documentation that NSAssert throws an exception, the unit test fails with an error message indicating that the application crashed.

This is with the SDK 3.1.3 in the simulator.

Is this a structural error or is there something I can do to make this work better, that is, for NSAssert to choose the right exception that the unit test macro can catch?

+5
source share
1 answer

I shot too fast.

It turns out that the problem was somewhere else:

, NSAssert, NSOject. , , . NSAssert , , , . NSObject , NSAssert , STAssertThrows.

, : , SignatureForSelector doesNotRecognizeSelector. , (NSLog(@"sel:%s", aSelector);), , . , .

, , , - , :)

, q .

+1

All Articles