9
我已经开始探索用于异步和性能测试的新XCTest API。另外,来自WWMC的Apple示例运行良好,但我一直无法弄清楚如何将它们结合起来。我能够想到的最好的是以下内容,但它在运行时收到以下错误:XCTest的异步性能测试
API违例 - 呼叫等待,没有设置任何期望。
XCTestExpectation *clsQueryReturnedExpectation = [self expectationWithDescription:@"clsQuery returned"];
PFCLSClient *theClient = [[PFCLSClient alloc] init];
[self measureMetrics:@[XCTPerformanceMetric_WallClockTime] automaticallyStartMeasuring:YES forBlock: ^{
[theClient getStructureOfType:clsImageTypeSVG ForID:idString success: ^(NSDictionary *structureInfo) {
[clsQueryReturnedExpectation fulfill];
} failure: ^(NSError *error) {
XCTFail();
[clsQueryReturnedExpectation fulfill];
}];
[self waitForExpectationsWithTimeout:5 handler: ^(NSError *error) {
[self stopMeasuring];
}];
}];
有没有人能够完成类似的事情?
Thx
除了时间以外还有什么可以测量的吗? API参考似乎表示它需要一组XCTPerformanceMetrics,但我无法在任何地方找到任何要测量的地方。 –
据我所知,不,你不能。我读过同样的东西,但认为苹果在这一点上还没有实现任何东西。 – spottedrabbit