Stephen McGruer | f889c89 | 2020-10-08 19:05:30 | [diff] [blame^] | 1 | # Addressing Flaky Web Tests |
| 2 | |
| 3 | ## Understanding builder results |
| 4 | |
| 5 | Often (e.g. by Flake Portal), you will be pointed to a particular build in which |
| 6 | your test has flaked. You will need the name of the specific build step that has |
| 7 | flaked; usually for Web Tests this is `blink_web_tests` but there are variations |
| 8 | (e.g. `not_site_per_process_blink_web_tests`). |
| 9 | |
| 10 | On the builder page, find the appropriate step: |
| 11 | |
| 12 | ![web_tests_blink_web_tests_step] |
| 13 | |
| 14 | While you can examine the individual shard logs to find your test output, it is |
| 15 | easier to view the consolidated information, so scroll down to the **archive |
| 16 | results for blink\_web\_tests** step and click the `layout_test_results` link: |
| 17 | |
| 18 | ![web_tests_archive_blink_web_tests_step] |
| 19 | |
| 20 | This will open a new tab with the results viewer. By default your test should be |
| 21 | shown, but if it isn't then you can click the 'All' button in the 'Query' row, |
| 22 | then enter the test filename in the textbox beside 'Filters': |
| 23 | |
| 24 | ![web_tests_results_viewer_query_filter] |
| 25 | |
| 26 | There are a few ways that a Web Test can flake, and what the result means may |
| 27 | depend on the [test type](writing_web_tests.md#Test-Types): |
| 28 | |
| 29 | 1. `FAIL` - the test failed. For reference or pixel tests, this means it did not |
| 30 | match the reference image. For JavaScript tests, the test either failed an |
| 31 | assertion *or* did not match the [baseline](web_test_expectations.md) |
| 32 | `-expected.txt` file checked in for it. |
| 33 | * For image tests, this status is reported as `IMAGE` (as in an image diff). |
| 34 | * For Javascript tests, this status is reported as `TEXT` (as in a text |
| 35 | diff). |
| 36 | 1. `TIMEOUT` - the test timed out before producing a result. This may happen if |
| 37 | the test is slow and normally runs close to the timeout limit, but is usually |
| 38 | caused by waiting on an event that never happens. These unfortunately [do not |
| 39 | produce any logs](https://crbug.com/487051). |
| 40 | 1. `CRASH` - the browser crashed while executing the test. There should be logs |
| 41 | associated with the crash available. |
| 42 | 1. `PASS` - this can happen! Web Tests can be marked as [expected to |
| 43 | fail](web_test_expectations.md), and if they then pass then that is an |
| 44 | unexpected result, aka a potential flake. |
| 45 | |
| 46 | Clicking on the test row anywhere *except* the test name (which is a link to the |
| 47 | test itself) will expand the entry to show information about the failure result, |
| 48 | including actual/expected results and browser logs if they exist. |
| 49 | |
| 50 | In the following example, our flaky test has a `FAIL` result which is a flake |
| 51 | compared to its (default) expected `PASS` result. The test results (`TEXT` - as |
| 52 | explained above this is equivalent to `FAIL`), output, and browser log links are |
| 53 | highlighted. |
| 54 | |
| 55 | ![web_tests_results_viewer_flaky_test] |
| 56 | |
| 57 | ## Reproducing Web Test flakes |
| 58 | |
| 59 | >TODO: add documentation on reproducing Web Test flakes |
| 60 | |
| 61 | ## Debugging flaky Web Tests |
| 62 | |
| 63 | >TODO: add documentation on debugging flaky Web Tests |
| 64 | |
| 65 | [web_tests_blink_web_tests_step]: images/web_tests_blink_web_tests_step.png |
| 66 | [web_tests_archive_blink_web_tests_step]: images/web_tests_archive_blink_web_tests_step.png |
| 67 | [web_tests_results_viewer_query_filter]: images/web_tests_results_viewer_query_filter.png |
| 68 | [web_tests_results_viewer_flaky_test]: images/web_tests_results_viewer_flaky_test.png |