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:
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) ?
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 ?
Or there are other solutions for this case ?
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.