iOS 按顺序运行 UITesting(文件和函数级别) [英] iOS Run UITesting in sequence (file and function level)

查看:21
本文介绍了iOS 按顺序运行 UITesting(文件和函数级别)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了这样的 UITesting.我需要按顺序运行这 3 个文件,我需要这样命名.我认为这很糟糕.我想更合乎逻辑地命名(而不是 Test1 等).是否可以重命名并按顺序运行?

I have created UITesting like this. I need to run those 3 file in sequence and I need to name like this. I think it is quite bad. I want to name more logically (instead of Test1,etc). Is it possible to rename and run in sequence?

另一个是我需要按字母顺序命名我的方法.我想随机命名并按顺序运行.我该怎么办?

Another one is I need to name my method alphabetically. I want to name randomly and run in sequence. How shall I do?

- (void)test2CreatePost 
- (void)test3ClickLikeInNewsfeed

推荐答案

函数嵌套适用于仅从 XCode 立即运行 UI 测试.但是当测试从命令行运行时,它们是按字母顺序运行的.我已经读过这个问题在 XCode 8 中的单元测试中得到了修复,但它似乎不适用于 UI 测试.

Functions nesting is fine for running UI tests from XCode instantly only. But when tests are running from command line, they are running by the alphabetic sequence. I've read that this issue was fixed for unit tests in XCode 8, but it seems not for UI tests.

例如,现在我有以下 UI 测试层次结构:

For instance, now I have the following UI tests hierarchy:

UITests
   TestCaseB
   TestCaseA

当我从 XCode 8.2.1 运行它们时,它们的执行顺序与它们描述的顺序相同,即:

When I run them from XCode 8.2.1 they are executed in the same sequence as they are described, i.e.:

TestCaseB
TestCaseA

但是当我使用 xcodebuild test TEST_TARGET_NAME=<TargetName> 从命令行运行它们时-scheme 目标 'platform=iOS Simulator,name=iPhone 7' 他们正在以另一个顺序运行:

But when I run them from command line using xcodebuild test TEST_TARGET_NAME=<TargetName> -scheme <UITestsSchemeName> destination 'platform=iOS Simulator,name=iPhone 7' they are running in another sequence:

TestCaseA
TestCaseB

小心.

这篇关于iOS 按顺序运行 UITesting(文件和函数级别)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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