I succeeded with the first part, that is receiving the distributed notification from within the setUp method, by letting the currentRunLoop
run
for a while:
- (void)setUp
{
[super setUp];
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(testerRunningNotification:) name:@"TesterReady" object:nil];
_t = [NSTask launchedTaskWithLaunchPath:[NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"../Tester.app/Contents/MacOS/Tester"] arguments:@[]];
while(!_testerRunning)
{
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
}
}
- (void)testerRunningNotification:(NSNotification *)notification
{
_testerRunning = YES;
}
Now I only need to figure out what's necessary to get distributed objects working from within a test case.