Mike Baxley | 47db7d8 | 2017-11-16 15:57:17 | [diff] [blame] | 1 | # Automated testing for Chrome for iOS |
| 2 | |
| 3 | See the [instructions] for how to check out and build Chromium for iOS. |
| 4 | |
| 5 | Automated testing is a crucial part of ensuring the quality of Chromium. |
| 6 | |
| 7 | ## Unit testing |
| 8 | |
| 9 | Unit testing is done via gtests. To run a unit test, simply run the test |
| 10 | target (ending in _unittest). |
| 11 | |
| 12 | ## Integration testing |
| 13 | |
| 14 | [EarlGrey] is the integration testing framework used by Chromium for iOS. |
| 15 | |
| 16 | ### Running EarlGrey tests |
| 17 | |
| 18 | EarlGrey tests are based on Apple's [XCUITest]. |
| 19 | |
| 20 | #### Running tests from Xcode |
| 21 | |
| 22 | An entire suite of tests can be run from Xcode. |
| 23 | 1. Select the *egtest target you wish to run. |
| 24 | 2. ⌘+U to run all the tests. Note: ⌘+R, which is normally used to run an |
| 25 | application, will simply launch the app under test, but will not run the |
| 26 | XCTests. |
| 27 | |
| 28 | A subset of tests can be run by selecting the test or test case from the |
| 29 | XCTest navigator on the left side of the screen. |
| 30 | |
| 31 | #### Running from the command-line |
| 32 | |
| 33 | When running from the command-line, it is required to pass in the *.xctest |
| 34 | target, in addition to the test application. |
| 35 | Example: |
| 36 | ``` |
| 37 | ./out/Debug-iphonesimulator/iossim -d "iPad Retina" -s 8.1 \ |
| 38 | out/Debug-iphonesimulator/ios_chrome_integration_egtests.app \ |
| 39 | out/Debug-iphonesimulator/ios_chrome_integration_egtests_module.xctest |
| 40 | ``` |
| 41 | |
| 42 | |
| 43 | [EarlGrey]: https://github.com/google/EarlGrey |
| 44 | [instructions]: ./build_instructions.md |
| 45 | [XCUITest]: https://developer.apple.com/documentation/xctest |