Record and Stream test execution in Appium

We all have the Take screenshot on Test failure in our framework. But sometimes the screenshot will not help us. We are like OMG why this test is failing state.

For those, this post will really helpful. We can record the whole test execution as a video with low resolution.

Prerequisite: Please install ffmpeg (brew install FFmpeg)

Start Recording the video

the above command will simply start the recording with default record options. We can add video quality, fps, time limit, video type, etc.,

Below is the sample code for adding medium video quality for iOS

Stop Recording the video

Here if you notice stopRecordingScreen() method is returning a String which is base64String format. we need to decode it to get the video as a file.

base64 String to Video

Note: we can use options for stop recording the video as well.

In the above code, we are decoding the base64 string and convert it into a .mp4 file. I’m storing the output screen recording video file in the target folder.

Streaming the test execution — iOS:

The very exciting part is we can see the test execution in the browser window. As soon as we start recording the video, Appium will stream the entire session in localhost:9100

For more info, refer here

Automation QA Engineer by profession. Learning iOS Development.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store