Make the build executable
1 file changed
tree: 9834977666e84703729b6f53016ebee6cbf771fd
  1. AppFramework/
  2. CommonLib/
  3. docs/
  4. EarlGrey.xcodeproj/
  5. scripts/
  6. TestLib/
  7. Tests/
  8. UILib/
  9. .gitmodules
  10. CONTRIBUTING.md
  11. LICENSE
  12. README.md
README.md

Note: EarlGrey 2.0 is currently in Alpha and doesn‘t support all forms of integration. In the coming quarters we’ll add support for Xcode Projects and CocoaPods as well. Please peruse the code and do bring forward any issues or concerns you might have with migrating your EarlGrey 1.0 tests to 2.0.

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

// Clone EarlGrey 2.0 with all its dependencies
git clone --recursive -b earlgrey2 https://github.com/google/EarlGrey.git

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

Currently, only the source code is available, with Xcode Project integration. To integrate with EarlGrey 2.0, please take a look at our 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.

Analytics

Similar to EarlGrey 1.0, EarlGrey 2.0 also collects an MD5 Hash of the Bundle ID, Test Class Names and Test Method Names. This allows us to measure the volume of usage. You can take a look at GREYAnalytics.m for how it's done.

If you wish, you can disable analytics by adding this to your test's -(void)setUp method:

In Objective-C:

// Disable analytics.
[[GREYConfiguration sharedConfiguration] setValue:@(NO) forConfigKey:kGREYConfigKeyAnalyticsEnabled];

In Swift:

// Disable analytics.
GREYConfiguration.sharedConfiguration().setValue(false, forConfigKey: kGREYConfigKeyAnalyticsEnabled)

EarlGrey 2.0 Advantages over XCUITest

  • Automatic synchronization with Animations, Dispatch Queues, 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.