Skip to content

toptal/EarlGrey

 
 

Repository files navigation

Apache License Build Status

Note: EarlGrey 2.0 currently supports Xcode Projects and building from source for both white and black box testing. CocoaPods support is present for black-box testing. Contributions are welcome for CocoaPods white-box testing and other package managers.

To use, please clone the earlgrey2 branch with its submodules:

// Clone EarlGrey 2.0
git clone -b earlgrey2 https://github.com/google/EarlGrey.git

// Download any dependencies
sh Scripts/download_deps.sh

EarlGrey 2.0

EarlGrey 2.0 is a native iOS UI automation test framework that combines EarlGrey with XCUITest, Apple's official UI Testing Framework.

EarlGrey 2.0 allows you to write clear, concise tests in Objective-C / Swift and enables out of process interactions with XCUITest. It has the following chief advantages:

  • Synchronization: From run to run, EarlGrey 2.0 ensures that you will get the same result in your tests, by making sure that the application is idle. It does so by automatically tracking UI changes, network requests and various queues. EarlGrey 2.0 also allows you to manually implement custom timings.
  • White-box: EarlGrey 2.0 allows you to query the application under test from your tests.
  • Native Development: As with EarlGrey 1.0, you can use EarlGrey 2.0 natively with Xcode. You can run tests directly from Xcode or xcodebuild. Please note that EarlGrey 2.0 uses a UI Testing Target and not a Unit Testing Target like EarlGrey 1.0.

EarlGrey 1.0 is a white-box testing tool that allows you to interact with the application under test. Since XCUITest is a black-box testing framework, this is not directly possible with EarlGrey 2.0. To fix this, we use eDistantObject (eDO) to allow these white-box interactions.

Using EarlGrey 2.0

To integrate with EarlGrey 2.0 using Xcode Projects, please take a look at our Setup Guide. For CocoaPods, please look at the CocoaPods Setup Guide.

For a quick sample project, take a look at our FunctionalTests project.

Getting Help

You can use the same channels as with EarlGrey 1.0 for communicating with us. Please use the earlgrey-2 tag to differentiate the projects.

Apple Privacy Description Labels & Analytics

EarlGrey is not intended to be shipped in user facing products so we are not supplying formal Apple Privacy Description Label guidelines. That being said, this product does not collect or transmit any analytics or personal data.

Licensing

All project source code is licensed under the Apache 2.0 license. All image resources are licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) license. The texts of both licenses are included in the LICENSE file.

EarlGrey 2.0 advantages over XCUITest

  • Automatic synchronization with Animations, Dispatch Queues, and Network Requests as enumerated here.
  • In-built White-Box Testing Support with RMI.
  • Better Support for Flakiness Issues.
  • Better Control of tests. EarlGrey has a much larger set of matchers.
  • EarlGrey performs a pixel-by-pixel check for the visibility of an element.

EarlGrey 2.0 advantages over EarlGrey 1.0

  • Out of Process Testing using XCUITest. So System Alerts, Inter-app interactions etc. are supported
  • Lesser throttling of the application under test's main thread.
  • Better support since accessibility is provided out of the box with XCUITest.

Caveats

  • You cannot directly access the application under test as with EarlGrey 1.0. You need to use eDistantObject (eDO) to do so.
  • XCUITest application launches can add a 6+ second delay. Please use XCUIApplication launch judiciously.

Packages

No packages published

Languages

  • Objective-C 95.3%
  • Ruby 1.9%
  • Swift 1.1%
  • Shell 0.8%
  • HTML 0.4%
  • CSS 0.3%
  • Python 0.2%