我可以多次运行 XCTest 套件吗?

Can I run an XCTest suite multiple times?(我可以多次运行 XCTest 套件吗?)
本文介绍了我可以多次运行 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 套件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type(异常:不应为错误类型创建SimpleTypeImpl)
Android IllegalArgumentException: The tag for fragment_XXX is invalid. Received: layout-sw600dp/fragment_XXX_0(Android IlLegalArgumentException:Fragment_XXX的标签无效。收到:Layout-sw600dp/Fragment_XXX_0)
Google Play Billing (testing mode): why my purchase is automatically canceled(Google Play计费(测试模式):为什么我的购买被自动取消)
HTTPS request using volley(使用 volley 的 HTTPS 请求)
Error: Name not maching for self signed SSL certificates on Android(错误:Android 上自签名 SSL 证书的名称不匹配)