26 Mar 2018.

Tags: Device Setup

Stb-tester supports automated testing on the Amazon Fire TV and Fire TV Stick.

Stb-tester portal showing live video from an Amazon Fire TV stick

To test your app you need a mechanism to control the Fire TV and a way to get feedback to check that your app is behaving as it should.

Stb-tester sends CEC commands (over the HDMI connection) to control the Fire TV, and captures the video over the same HDMI connection to verify your app’s behaviour. CEC is the same technology that allows you to use your TV’s remote to control the Amazon Fire.


You will need our USB CEC adapter. If we didn’t ship one with your Stb-tester device, contact support@stb-tester.com. Plug it in as per the diagram below — the Stb-tester Node will automatically use the CEC adapter if there is no infrared transmitter connected.

CEC is enabled by default on the Fire TV. If you had previously disabled it, you can re-enable it by going to Settings > Display & Sounds > HDMI CEC Device Control.

Key names

In your test scripts you can use the following key names:

  • "KEY_UP"
  • "KEY_DOWN"
  • "KEY_LEFT"
  • "KEY_OK"
  • "KEY_BACK"
  • "KEY_HOME"
  • "KEY_PLAY"

Waking from sleep

The Fire TV doesn’t implement the CEC command for “power on”. To work around this, you can stop the Fire TV from going to sleep by running the following ADB commands (this setting isn’t available from the Fire TV’s on-screen settings menus):

  1. First enable ADB in Settings > Device > Developer Options > ADB debugging.
  2. Go to Settings > Device > About > Network. Note the Fire’s IP address.
  3. In your terminal, run adb connect (substituting your Fire’s actual IP address).
  4. Again in your terminal, run adb shell settings put secure sleep_timeout 0

This setting persists after power-cycling the Fire TV.

For more help on steps 1-3 see Amazon’s developer documentation Connect to Fire TV Through ADB.

Inter-press delay

If you send several keypresses too quickly, the Fire TV doesn’t always send the ACK (acknowledgement) specified by the CEC protocol. When this happens, Stb-tester’s stbt.press function will raise an exception, to avoid false positives in your tests.

To prevent this from happening you can enforce a minimum delay of 3 seconds between keypresses, by specifying interpress_delay_secs in your test-pack’s .stbt.conf file:

interpress_delay_secs = 3