I would like to test a subclass NSOperation. I tried to do this in my subclass SenTestCase:
- (void)setUp {
[super setUp];
_importQueue = [[NSOperationQueue alloc] init];
[_importQueue setMaxConcurrentOperationCount:1];
[_importQueue waitUntilAllOperationsAreFinished];
}
- (void)tearDown {
[_importQueue release];
[super tearDown];
}
- (void)testSomeImport {
ImportOperation *op = [[ImportOperation alloc] initWithFile:...];
[_importQueue addOperation:op];
[op setDelegate:self];
[op release];
}
- (void)opDidFinish:(ImportOperation *)op {
}
But tests end before completion NSOperation, despite the indication waitUntilAllOperationsAreFinished.
Any ideas on how to prevent the completion of the test before the completion of my operation?
source
share