我可以多次运行XCTest套件吗? [英] Can I run an XCTest suite multiple times?

查看:71
本文介绍了我可以多次运行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套件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆