7

我在仪器中设置了一组自动化测试用例,使用 tuneup.js 来测试应用程序。我决定使用 tuneup.js,因为它允许我将我的测试分成单独的测试用例并从一个单独的脚本运行整个集合,如果所有测试都运行正常,这很好,但是如果一个失败,所有测试都失败,因为模拟器处于未知状态(我已经编写了测试,所以它们都在同一个登录屏幕上开始和结束)有没有办法重置模拟器,或者在测试用例之间重新启动应用程序?

4

3 回答 3

0

Try to launch tests from the command line. UI Automation allows to execute only one test in one run. After the test will be completed (does not matter if it was failed or passed) - application will be kicked by the system (UIAutomation). At least it works with real devices.

Your command line launch script will work in the following manner: 1. Reads configuration file (can be any file txt or xml) with path to your tests. At this point you will have an array with path to your tests and total tests count. 2. Then using simple 'for' loop (from 1 to 'testcount') it will launch UIAutomation with required parameters. One of the parameters will be the path to your test script that was read from the configuration file.

You can also put the path to the 'configuration file' as a parameter for your command line launch script. This will allow you to run any test set simply calling the launch script with required configuration file.

于 2012-07-09T12:15:49.400 回答
0

我编写了一个脚本,它将重置 iOS 模拟器的所有版本和设备的内容和设置。它从菜单中获取设备名称和版本号,因此它将包括 Apple 为其发布模拟器的任何新设备或 iOS 版本。

它很容易手动运行或在构建脚本中使用。我建议在构建之前将其添加为 Pre-Action Run Script。

https://github.com/michaelpatzer/ResetAllSimulators

于 2013-10-18T17:11:52.340 回答
0

测试失败会使您的应用程序处于未知状态是按原样使用 Apple 仪器工具的主要问题之一。我们在一个名为Illuminator 的框架(在 GitHub 上,受 tuneup.js 启发)以两种方式解决了这个问题。

首先,我们编写了一个自动化桥——一个用于 RPC 与正在测试的应用程序的通道,它允许我们在每次测试之前重置我们的应用程序。

如果这还不够,Illuminator 测试运行器可以选择在模拟器的原始启动中重新运行每个失败的测试(例如,使用--retest 1x,solo)。

于 2015-04-02T14:04:50.910 回答