Our Engineering and QA teams here at Applause use Appium on a regular basis. When we noticed that Appium, the leading solution for automated mobile tests, had built-in support for mjpeg screenshot streaming on iOS but not on Android, this made us pause. We wanted to see if it would be possible to add this feature for Android, so we worked with the Appium team at Sauce Labs to make it happen.
Why Screenshot Streaming?
With automated functional testing for mobile apps, knowing that a test failed is helpful, but it’s better to have visuals that tell the story.
Screenshot streaming, similar to video recordings, captures what is happening in an app over time and makes it possible to get a much clearer picture of what happened during testing. However, screenshot streaming is more interactive and optimizes the performance in the process because the device is pushing data to the client — rather than the client having to repeatedly poll the device for updated information.
In that way, screenshot streaming brings a closer-to-real-time experience than video because you’re essentially looking at the test as it happens. This helps the tester detect issues that could be easily missed otherwise, and additionally decreases the time to iterate during test development.
For example, automatically capturing a streaming of an application process that fails can reveal the user’s precise clicks or touches before the failure. Or streaming images of failed tests for collision detection in a mobile action game can quickly identify problems with an object’s bounding box.
There are an endless number of situations where having a screenshot stream can pinpoint problems within an app, and when it comes to testing, knowing more is always better. In many testing scenarios, having a screenshot stream helps provide the full context.
Appium in Automated Device Testing
Today, Appium is the go-to test automation framework for mobile devices because it allows cross-platform testing on devices and emulators with zero dependencies on the app and the operating system. We use Appium at Applause — and love it.
With Appium, you don’t need to add any SDK or library code to your app. It works by translating WebDriver automation commands into native mobile device commands for iOS through XCUITest, and for Android via UiAutomator2.
The XCUITest driver supports screenshot streaming through an mjpeg server functionality. This enables us to simply open a web browser to the local URL and view a livestream of the device screen, with configurable screenshot quality and framerate through the Appium settings API. This feature was missing from UiAutomator2.
Because screenshot streaming can be such a critical tool for discovering issues during automated functional testing, finding out that this capability was not available for Android devices inspired the Applause Labs team to get our hands dirty (and our code ready) to make this happen.
Having recently built this capability into our fork of the UiAutomator2 repository and wanting to give back to the open-source community, our Applause Labs team worked directly with the Appium team to add this feature to UiAutomator2 with the same configurable settings that were available in XCUITest. We submitted a pull request to be merged into Appium along with changes to the documentation. Screenshot streaming for both iOS and Android devices is now available in the beta release and will be available in the next major release of the Appium platform.
Better Testing for Everyone
Having screenshot streaming makes Appium’s Android testing capabilities match those available for iOS devices. For us at Applause, simultaneous cross-platform testing of mobile apps is especially valuable because it helps ensure that the testing experience and results are consistent across platforms.
It was a great experience working with the Appium team to add this feature to UiAutomator2 for Android devices. We are happy to be a contributing member of the Appium open-source community: our work together makes automated testing better for everyone.
Next time you are testing an app on an Android device with Appium, give screenshot streaming a try. Share your best app clip with us because we would love to see it in action.