Appium & Robot Framework: Record Test Execution

laojala profile image Laura Ojala Updated on ・2 min read

The latest release of the Robot Framework's Appium Library introduces keywords for recording a video of the Appium test execution in iOS and Android phones.

Instructions for use:

  1. If test is run in iPhone, install ffmpeg in the Mac where Appium is running: brew install ffmpeg
  2. Simple use case: Use Appium Library's keyword Start Screen Recording in the Test Setup and Stop Screen Recording in the Test Teardown. Recording is stored in the same place where Robot test case reports are. Video file is not stored permanently to the storage of the phone.
  3. Error-proof use case: Some Android phones (for example Huawei models) are not capable of recording the screen and the test case will fail (in the latest Appium library - this might change in the future). It is a good idea to start and stop recording using a keyword Run Keyword And Ignore Error (remember also import BuiltIn library for the Robot Framework code). Here's an example of this error-proof case:
  4. Storing recording only for failed tests: Here's an example code that stores screen recording only when a test case fails:

Free word

In my opinion, this example showcases nicely how the use of readily available Robot Framework libraries reduces the amount of test automation code (and thus less maintenance and bugs in it!). Capturing video of the screen is now only a few simple lines of code, whereas file handling using native Appium would require more logic.

Posted on by:


markdown guide