the Chromium logo

The Chromium Projects

Android Tests

Concepts

Running Tests

View this guide for running Android tests: https://chromium.googlesource.com/chromium/src/+/HEAD/docs/testing/android_test_instructions.md

Location of Test Code

As a general rule, tests should live next to the production code and test utilities should live in a test folder. In general, this should look like:

Test utilities that are pure Java and do not depend on content or other Chromium code should live in:

Test utilities in the content layer that are re-used by chrome should live in:

The location of integration instrumentation tests depends on what they are testing:

Please note that this implies that outside of Content Shell, Chrome Test Shell and Android WebView, you should:

Guidelines for Writing Tests

TestBase Classes and Test Utilities

Annotations

Each instrumentation test should have a test size and feature annotation.

Test Size Annotations

Feature Annotation

Flaky and Crashing Tests

If a test is flaky or randomly crashes, the test should not run on the build bots. The guidelines for handling flaky and crashing tests are as follows: