我可以并行运行多个iOS UI测试吗?

Bil*_*ill 6 xcode ui-testing ios ios-simulator xcode-ui-testing

我正在为我的iOS应用程序构建UI测试套件.我需要在几个不同的设备上测试我的应用程序的功能,但是现在我必须选择我想要的模拟器,运行测试,然后重复.

现在Xcode支持多个并行运行的模拟器,有没有办法同时在多个不同的设备模拟器上运行UI测试?

Ole*_*tha 5

在项目所在的同一目录中运行以下命令,以从命令行并行运行测试:

xcodebuild test -scheme "YourSchemeName" -destination 'platform=iOS Simulator,OS=11.2,name=iPhone 8' -destination 'platform=iOS Simulator,OS=11.2,name=iPhone 6s'  -configuration "Debug" ENABLE_TESTABILITY=YES SWIFT_VERSION=4.0 ONLY_ACTIVE_ARCH=YES
Run Code Online (Sandbox Code Playgroud)

您可以-destination 'platform=iOS Simulator,OS=11.2,name=iPhone 8'根据需要添加任意多个不同的目的地。

要获取可用模拟器名称和操作系统的列表,请运行以下命令:

instruments -s devices
Run Code Online (Sandbox Code Playgroud)

请记住,如果您在模拟器中运行测试,则通过命令行运行测试时,您将不会在屏幕上看到模拟器。