I have a subclass of XCTestSuite that I instantiate and populate with tests on the fly:
+ (XCTestSuite *)defaultTestSuite {
MySuite *suite = [[MySuite alloc] initWithName:@"suite"];
[suite addTest:[[MyTestCase alloc] initWithSelector:@selector(firstTest)]];
[suite addTest:[[MyTestCase alloc] initWithSelector:@selector(secondTest)]];
return suite;
}
+ (void)setUp {}
- (void)setUp {}
- (void)firstTest {}
- (void)secondTest {}
The -(void)setUp
is being called for each test, but +(void)setUp
is never called. If I don't use my custom testSuite or I call:
+ (XCTestSuite *)defaultTestSuite {
XCTestSuite *suite = [super defaultTestSuite];
[suite addTest:[[MyTestCase alloc] initWithSelector:@selector(firstTest)]];
[suite addTest:[[MyTestCase alloc] initWithSelector:@selector(secondTest)]];
it does get called. Why is this?