NSInternalInconsistencyException在Xcode中测量性能时,性能指标必须提供10个测量

问题描述 投票:0回答:1

当试图测量do try类中XCTestCase块的性能时,我得到了failed: caught "NSInternalInconsistencyException", "Performance Metrics must provide 10 measurements."。我内部的断言也失败了,但是一旦我把它从self.measure块中取出,它就可以了。

let name = "foo"  
    self.measure {
        do {
            _ = try myStore.controller.createObject(named: name)
        } catch let error {
            XCTAssert(false, "Should be able to create object named \(name): \(error)")
        }
    }

任何人都知道我在self.measure里面的方式有什么问题?

swift xcode performance xctest
1个回答
0
投票

问题是当我尝试创建一个已存在名称的对象时,我的myStore.controller.createObject(named: name)方法会抛出错误。 self.measure运行10次,所以我试图创建具有相同名称的对象。

© www.soinside.com 2019 - 2024. All rights reserved.