On Wednesday, Google released their aptly named UI testing framework, EarlGrey. Having been using the framework in a few of their current iOS apps already for functional testing, it’s good to hear that the product has been validated before an initial public release.
EarlyGrey offers a few key features to help differentiate it from other functional testing frameworks, the most interesting to me personally is the built-in synchronization feature. This means that when tests are being executed, they’ll automatically wait for “animations, network requests, etc.” before interacting with UI. Developers are now freed up from having to write tests that account for waiting or “sleeping” before proceeding to the next test.
The key features offered by EarlGrey include:
Powerful built-in synchronization : Tests will automatically wait for events such as animations, network requests, etc. before interacting with the UI. This will result in tests that are easier to write (no sleeps or waits) and simple to maintain (straight up procedural description of test steps). Visibility checking : All interactions occur on elements that users can see. For example, attempting to tap a button that is behind an image will lead to test failure immediately. Flexible design : The components that determine element selection, interaction, assertion and synchronization have been designed to be extensible.
For developers out there worried about EarlGrey clashing against Xcode’s own testing frameworks Google states that, ”EarlGrey works in conjunction with the XCTest framework and integrates with Xcode’s Test Navigator so you can run tests directly from Xcode or the command line (using xcodebuild).”
EarlGrey is available as an open-source project on GitHub under the Apache license and may be added to your current Xcode project using CocoaPods or manually adding it in.
Google’s list of apps currently utilizing the EarlGrey framework are: YouTube, Google Calendar, Google Photos, Google Translate, and Google Play Music.
FTC: We use income earning auto affiliate links. More.
Does it throw errors for using Material Design conventions in an iOS app?