【发布时间】:2016-11-17 10:54:04
【问题描述】:
如果运行速度低于 0.5 秒,我希望我的测试失败,但平均时间只是打印在控制台中,我找不到访问它的方法。有没有办法访问这些数据?
代码
//Measures the time it takes to parse the participant codes from the first 100 events in our test data.
func testParticipantCodeParsingPerformance()
{
var increment = 0
self.measureBlock
{
increment = 0
while increment < 100
{
Parser.parseParticipantCode(self.fields[increment], hostCodes: MasterCalendarArray.getHostCodeArray()[increment])
increment++
}
}
print("Events measured: \(increment)")
}
测试数据
[Test.Parsertest TestParticiPantCodeParsingPerformance]'测量[时间,秒]平均:0.203,相对标准偏差:19.951%,值:[0.186405,0.182292,0.179966,0.179966,0.179966,0.179966,0.17966,0.179966,0.179966,0.179966,0.179966,0.179966,0.17966,0.177797,0.175820,0.20576,0.315636,0.223014,0.200362,0.178165]
【问题讨论】:
标签: ios swift performance performance-testing