1

I have both Android App which act as receiver for heart rate from Android Watch and app for Wear OS, which sent heart rate to the app.
For test without my hardware, i created two emulators and paired them. Manual testing show that apps working just fine, watch sends heart rate data and app received it

But I have next questions:

  1. When app reaches a specific test package inside the phone test code - is there a way to automatically run an emulator of Wear OS device, install a specific apk, and start tests package (which would be synchronized with a test flow in app to pass) ?

  2. There is no solution for such level of automation yet, and I should stick to mocking info for both devices - mock received heart rate from wearOS in the phone, and mock received info from the phone on the wearOS device ?

  3. Or there are other solutions for this case ?

AShX
  • 358
  • 3
  • 14

1 Answers1

1

I'd concentrate on the bulk of your testing working on each side, with the remote side mocked out. Any test with two emulators or devices will likely be somewhat flaky.

But you probably want a few cross device tests.

You can use a framework like Mobly for cross device tests. https://jeffhermanmobly.readthedocs.io/en/latest/tutorial.html#example-5-test-with-multiple-android-devices

There are other frameworks like https://thesoftwaredesignlab.github.io/KrakenMobile/. Or level level like Adam or Dadb that would let you connect and send commands to two devices.

Yuri Schimke
  • 12,435
  • 3
  • 35
  • 69
  • Thank you for the answer. So far i think to stick to mocking a call to Wear OS from the app, basically create a call to a service that receive data from the phone. Just need to figure out how to do this – AShX Oct 27 '22 at 10:31
  • You might just want to put all calls to Data Layer behind some domain specific interface. Then test against that interface. Then have one integration test that tests it end to end. – Yuri Schimke Oct 28 '22 at 14:30