简体   繁体   中英

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. So when Phone 1 has completed the test run, Phone 2 begin its test run.

I'm looking for a command similar to ./gradlew cAT but not simultaneously. 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.

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. 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.
  • 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. It works out-of-the-box, without any code changes.

A few similar tools:

composer

marathon

fork

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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