-1

我面临一个问题。我想为我的应用程序做一个 ui 测试。

我写了六个测试类,其中包括我的测试用例。

我可以使用运行我的测试用例

"command U" or the clicking in the run button.

但我不想这样做。

我想使用我的意思是使用的代码运行我的测试类

xctest because after complete my execution, i have to do another task.

谁能举个例子,我如何使用类文件中的 xctest 编码运行我的测试类。

我不想使用 shell 脚本或 jenkins,我想要使用 xctest 框架。

4

2 回答 2

1
  1. 编辑您的 Xcode 方案。
  2. 单击“测试”旁边的显示三角形以显示更多选项。
  3. 选择“后期操作”
  4. 单击“+”以添加要在测试完成后运行的任何操作。

在此处输入图像描述

如您所见,您的选择是运行脚本或发送简单的电子邮件。有关配置操作的更多信息,请参阅https://michele.io/the-project-file-part-2/

于 2016-06-12T01:20:58.897 回答
1

使用 xcodebuild 运行测试 xcodebuild 命令行工具可以像 Xcode IDE 一样驱动测试。使用动作测试运行 xcodebuild 并使用 -destination 参数指定不同的目的地。例如,要在本地 OS X “My Mac 64 Bit”上测试 MyApp,请使用以下命令指定目标和架构:

> xcodebuild test -project MyAppProject.xcodeproj -scheme MyApp -destination 'platform=OS X,arch=x86_64'

如果您插入了支持开发的设备,您可以通过名称或 ID 调用它们。例如,如果您连接了一个名为“Development iPod touch”的 iPod touch,您想在上面测试您的代码,您可以使用以下命令:

> xcodebuild test -project MyAppProject.xcodeproj -scheme MyApp -destination 'platform=iOS,name=Development iPod touch'

测试也可以在模拟器中运行。使用模拟器轻松定位不同的外形尺寸、操作系统和操作系统版本。模拟器目标可以通过名称或 ID 指定。例如:

> xcodebuild test -project MyAppProject.xcodeproj -scheme MyApp -destination 'platform=Simulator,name=iPhone,OS=8.1'

资源

于 2016-06-10T08:36:54.767 回答