在Xcode 6中使用XCTest进行订购单元测试 [英] Ordering unit test using XCTest in Xcode 6

查看:114
本文介绍了在Xcode 6中使用XCTest进行订购单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何方法可以告诉Xcode按指定的顺序运行单元测试。我的意思是不是在同一个XCTestCase类文件中,而是在所有类文件之间。

I would like to know if there is any way to tell Xcode to run unit tests in a specified order. I mean not in a same XCTestCase class file, but between all the class file.

例如,我想在运行SitchozrSDKMessageTest之前运行SitchozrSDKSessionTest。

For example I want to run the SitchozrSDKSessionTest before running SitchozrSDKMessageTest.

我查看了堆栈或Apple文档中的几个线程,但我找不到有用的东西。

I looked over few threads on stack or on Apple documentation and I haven't found something helpful.

感谢您的帮助。

推荐答案

全部按字母顺序排序(类和方法)。因此,当您需要最后运行的某些测试时,只需更改Class或Method的名称(对于(讨厌的)示例,通过前缀'z _')。

It's all sorted alphabetically (classes and methods). So when You need some tests running last, just change the name of Class or Method (for (nasty) example by prefixing 'z_').

所以......你有班级名称:

So...You have Class names:

MyAppTest1
  -testMethodA
  -testMethodB
MyAppTest2
  -testMethodC
  -testMethodD

它们按此顺序运行。如果您需要将MyAppTest1作为第二个运行,只需重命名,以便它的名称按字母顺序排在MyAppTest2(z_MyAppTest1)之后,它将运行(方法相同):

and they run in this order. If you need to run MyAppTest1 as second, just rename so it's name is alphabetically after MyAppTest2 (z_MyAppTest1) and it will run (same for method):

MyAppTest2
  -a_testMethodD
  -testMethodC
z_MyAppTest1
  -testMethodA
  -testMethodB

另外请以命名为例:)

这篇关于在Xcode 6中使用XCTest进行订购单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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