Can I run an XCTest suite multiple times?(我可以多次运行 XCTest 套件吗?)
问题描述
是否可以让 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 套件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我可以多次运行 XCTest 套件吗?
基础教程推荐
- 在 appComponent dagger 2 中动态添加测试模块? 2022-01-01
- 如何将多个组件添加到 PickerView? 2022-01-01
- 在 Android 模拟器中激活网络位置提供程序? 2022-01-01
- 可可/目标C(OSX不是iOS)从子对象访问父对象 2022-01-01
- 突出显示朗读文本(在 iPhone 的故事书类型应用程序中) 2022-01-01
- Android:STATE_SELECTED不工作 2022-01-01
- 在 iOS8 中无法获得正确的键盘高度值 2022-01-01
- 新的@SystemApi 注解是什么意思,和@hide 有什么区别 2022-01-01
- 我的 UIImageView 的任务 2022-01-01
- - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view 如何工作 2022-01-01
