views:

17

answers:

1

And how do I do it, since obviously there are a lot of async methods, and no way (that I know of) to check them in a unit test.

For example:


- (void) testSomeTest {
// things
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(helperTestSomeTest:)
name:connectionFinished
object:nil];
// connect to server
}
- (void) helperTestSomeTest:(NSNotification)notification {
 STAssertWhatever(whathever, nil); // not working
}

A: 

You have a variety of solutions to Unit test this. Mock objects, Stubs, and Fakes all come to mind.

They seem similar, but this is a great look at the differences.

By the way, to directly answer your question-line: Yes, test 100% of the code. Everything.

Mike
OK test everything, roger.
gurghet