iOS test runner is a python script responsible for setting up test environment, executing iOS tests, organize and report test results to resultdb, and cleaning up test environment at the end.
There are mainly 4 types of tests we run on the waterfall using the script:
Below are brief summaries for some of the major workflow steps when test runner is being invoked:
Please make sure to ALWAYS write sufficient unit tests to cover any new changes you have made to the scripts.
Besides unit tests, there are also a few ways you can test out your changes, listed below:
The easiest way is to upload your cl, and run a try job. Usually chromium/ios-simulator or chromium/ios-simulator-full-configs are sufficient.
INTERNAL ONLY: if you have made changes related to physical devices, then you can also run try jobs on chrome/iphone-device or chrome/ipad-device.
The cons of running try jobs are that they always perform a series of steps to build chrome, run a bunch of unit tests + EG tests and are very time consuming. If you are experimenting with new code and need to test out changes fast and iteratively, the next two ways below are recommended.
You can also execute test runner locally to get immediate results. Make sure you have your test app already built and Xcode downloaded on your laptop.
Note: in order to run unit tests, you also need to add enable_run_ios_unittests_with_xctest = true
under [gn_args]
in your ~/.setup-gn
file before building your test targets
first cd into local_runner/
folder
configure your test runner args in .txt format. Test args will vary slightly depending on the type of tests you are trying to run. If you are unsure, you can always copy one of the txt file from example_args folder and edit to match your needs.
Required args:
/Users/yueshe/bling/src/out/Debug-iphonesimulator
/Application/Xcode.app
/Users/yueshe/depot_tools/mac_toolchain
ios_chrome_ui_eg2tests_module-Runner.app
Test specific args:
ios_chrome_eg2tests.app
"iPad Pro (12.9-inch) (5th generation)"
. Note that quotation is needed.17.4
Optional args:
:
. By default the test runner will run all the test cases in your test app. Having a filter is highly recommended for running EG tests to save your test execution time. E.g. "AddressBarPreferenceTestCase:SearchEngineTestCase"
(quotes required)After you have created your own .txt arg file, run the command ./local_run.sh [your arg file name].txt
(If you don't have Xcode installed, it might ask you to confirm whether you would like test runner to install it) Pick the type of tests you would like to run, and it should start running...
At the end of the run, it should create a folder that looks like run_[a random number]/
. The folders contains a bunch of relevant test result files such as test screenshots, logs, xcrun files, etc... just like what you would see in the CAS Output of a swarming run. Please be careful to not include those files in your cl.
Still WIP, instructions coming soon... However, it will most likely utilize the script src/tools/run-swarmed.py
, and have a very similar running process from above. E.g. ./run-swarmed.py < [your arg file name].txt