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

xiaoxiao2021-02-28  87

- (void)testAsync { //设置预期 XCTestExpectation *expactation = [self expectationWithDescription:@"异步测试"]; [Person loadPersonAsync:^(Person *person) { NSLog(@"%@",person); //预期达成 [expactation fulfill]; }]; //预期超时等待 [self waitForExpectationsWithTimeout:10 handler:nil]; }
转载请注明原文地址: https://www.6miu.com/read-75335.html

最新回复(0)