Slide 8
Slide 8 text
CONTINUOUS INTEGRATION
8
UNIT TESTING - CHOICE OF FRAMEWORKS
- (void)testUsernameLoad
{
XCTestExpectation *expectation = [self
expectationWithDescription:@"Testing Async"];
[view.user loadWithCompletion:^{
XCTAssertEqual(label.text, @"Foo");
[expectation fulfill];
}
[self waitForExpectationsWithTimeout:5.0
handler:^(NSError *error) {
if(error) {
XCTFail(@"Failed with error: %@",
error);
}
}];
}
it("equals YES", ^
{
expect(view.isHidden).to.equal(YES);
});
it(@"sets the user's name", ^
{
[view.user load];
expect(label.text).will.equal(@"Foo");
});
From XCTests on the left to Specs on the right.
Specs make really easy to read and understanding test code.