- (void)testAsync {
//设置预期
XCTestExpectation *expactation = [self expectationWithDescription:@"异步测试"];
[Person loadPersonAsync:^(Person *person) {
NSLog(@"%@",person);
//预期达成
[expactation fulfill];
}];
//预期超时等待
[self waitForExpectationsWithTimeout:10 handler:nil];
}
iOS单元测试中测试异步方法
最新推荐文章于 2021-03-21 13:33:00 发布