I'm build a set of XCTestCase methods to exercise the code around my core data model. I am planning on calling some of the test methods from other test methods so I can see different combinations of data while keeping the code to a minimum. I can't imagine why this would not work, but I'm wondering what the world thinks and whether this is considered to be good practice.
Here's what it would look like:
@interface sessionTests : XCTestCase
@property (strong) Model *model;
@end
- (void)setUp
{
[super setUp];
_model = [[Model alloc]init];
}
- (void) testValue1
{
_model.value = 1;
XCTAssertTrue(_model.value == 1, @"model.value is not 1");
}
- (void) testValue2
{
_model.value = 2;
XCTAssertTrue(_model.value == 2, @"model.value is not 2");
}
- (void) testStringHello
{
_model.str = @"Hello";
XCTAssertTrue([_model.str isEqualToString:@"Hello"], @"model.str is not Hello");
}
- (void) testHello1
{
[self testValue1];
[self testStringHello];
}
- (void) testHello2
{
[self testValue2];
[self testStringHello];
}