Tutorial by Examples

Import the class, which contains the method to be tested. Perform the operation with dummy data. Now compare the result of operation with expected result. - (void)testReverseString{ NSString *originalString = @"hi_my_name_is_siddharth"; NSString *reversedString = [self.someObject ...
- (void)testDoSomethingThatTakesSomeTime{ XCTestExpectation *completionExpectation = [self expectationWithDescription:@"Long method"]; [self.someObject doSomethingThatTakesSomeTimesWithCompletionBlock:^(NSString *result) { XCTAssertEqualObjects(@"result", result, @"Re...
1. For Synchronous methods : - (void)testPerformanceReverseString { NSString *originalString = @"hi_my_name_is_siddharth"; [self measureBlock:^{ [self.someObject reverseString:originalString]; }]; } 2. For Asynchronous methods : - (void)testPerformanceOfAsynch...
Run all tests by choosing Product > Test. Click the Test Navigator icon to view the status and results of the tests. You can add a test target to a project (or add a class to a test) by clicking the Add (plus) button in the bottom-left corner of the test navigator. To view the source code for a ...
Make sure that include unit test case box is checked when creating a new project as shown below:

Page 1 of 1