是否可以让 Xcode 多次运行您的单元测试?
Is it possible to have Xcode run your unit tests multiple times?
我在几个单元测试中遇到了导致间歇性故障的问题.现在我认为我已经修复了它,我唯一的选择似乎是混合 ⌘ + U 直到我有 95% 的把握该错误是走了.
I had an issue in several unit tests that caused intermittent failures. Now that I think I've fixed it, my only option appears to mash ⌘ + U until I'm 95% confident the bug is gone.
我知道其他单元测试框架可以很容易地多次运行单个测试、测试用例或测试套件.我们在 XCTest 中是否拥有这种奢侈?
I know other unit testing frameworks make it quite easy to run a single test, test case, or test suite multiple times. Do we have this luxury in XCTest yet?
或许对你使用有帮助
func testMultiple() {
self.measureBlock() {
...
XCTAssert(errMessage == nil, "no error expected")
}
}
这会多次运行 self.measureBlock() 中的代码来测量平均时间.
This runs the code inside self.measureBlock() multiple times to measure the average time.
更改代码是可行的,但您可能还是想知道执行时间.
It is work to change the code, but you might want to know the execution time anyways.
这个答案可能与您想要的足够接近,并且很容易做到.
This answer might be close enough to what you want and it is easy to do.
这篇关于我可以多次运行 XCTest 套件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!