How can I include keyevents while macrobenchmarking?

45 views Asked by At

I would like to improve the performance of my app by the use of macrobenchmarks. Since my app is based on TV devices, user jounrneys will largely include using keyevents on a remote control.

What I would like to know is how can I emulate keypresses (both tap and hold types) while writing a test inside profileblock? Something like press Dpad DOWN, hold Dpad UP, etc.

1

There are 1 answers

0
mlykotom On

You can use UiAutomator's pressDPad*() methods or pressKeyCode(). Check reference for options.

In profileBlock you can access UiDevice with the device property.

Check JetStream TV sample for inspiration