您的位置:首页 > 移动开发 > IOS开发

iOS单元测试中测试异步方法

2017-06-08 12:01 260 查看
- (void)testAsync {

//设置预期
XCTestExpectation *expactation = [self expectationWithDescription:@"异步测试"];
[Person loadPersonAsync:^(Person *person) {
NSLog(@"%@",person);
//预期达成
[expactation fulfill];
}];
//预期超时等待
[self waitForExpectationsWithTimeout:10 handler:nil];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ios 单元测试 异步