简体   繁体   English

是否可以在多个设备上一个接一个地从终端运行 android espresso ui 测试?

[英]Is it possible to run android espresso ui tests from the terminal on multiple devices one after another?

I'm trying to run my ui tests on at least 2 phones but it can't be simultaneously, they have to run after each other.我正在尝试在至少 2 部手机上运行我的 ui 测试,但不能同时运行,它们必须相互运行。 So when Phone 1 has completed the test run, Phone 2 begin its test run.因此,当电话 1 完成测试运行时,电话 2 开始其测试运行。

I'm looking for a command similar to ./gradlew cAT but not simultaneously.我正在寻找类似于./gradlew cAT但不是同时的命令。 An alternative would be to specify which phone the tests should run on.另一种方法是指定测试应该在哪部手机上运行。 The reason is I need to be able to run the tests through GitLab CI.原因是我需要能够通过 GitLab CI 运行测试。

Is it possible to do this from the terminal?是否可以从终端执行此操作?

The easiest way to do this would likely be to create a script that calls your gradle task with each specific device serial set beforehand.执行此操作的最简单方法可能是创建一个脚本,该脚本预先使用每个特定设备序列集调用您的 gradle 任务。 This is theoretical, but should work.这是理论上的,但应该有效。

ANDROID_SERIAL=<firstDeviceSerial> ./gradlew <yourCommand>
ANDROID_SERIAL=<secondDeviceSerial> ./gradlew <yourCommand>

They introduced the notion of pools of devices.他们引入了设备池的概念。 These are now responsible for running a test suite instead of each device running the suite separately.这些现在负责运行测试套件,而不是每个设备单独运行套件。 That has two side effects:这有两个副作用:

  • infinite scaling: your tests can speed up by as many devices and emulators as you can dedicate to your CI box.无限扩展:您的测试可以通过尽可能多的设备和模拟器来加速,因为您可以将其用于 CI 盒。
  • because test suites now get scheduled to run on a pool, not all tests will run on all devices.由于测试套件现在被安排在池上运行,因此并非所有测试都将在所有设备上运行。 For that reason, we also introduced a way to create a pool per device, which offers full coverage (aka Spoon-mode) but typically takes longer, so we run it on a nightly basis.出于这个原因,我们还引入了一种为每个设备创建一个池的方法,该方法提供全面覆盖(又名 Spoon 模式),但通常需要更长的时间,因此我们每晚运行一次。 It works out-of-the-box, without any code changes.它开箱即用,无需任何代码更改。

A few similar tools:几个类似的工具:

composer作曲家

marathon 马拉松

fork叉子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM