• Home
Name Date Size #Lines LOC

..--

README.mdD03-May-20243 KiB3630

android_test_instructions.mdD03-May-202410.1 KiB313218

components_for_testing.mdD03-May-20246.3 KiB163130

gtest_implementation.mdD03-May-20247.3 KiB133109

instrumentation.mdD03-May-202412.3 KiB293231

junit.mdD03-May-20244.5 KiB150105

junit4.mdD03-May-202411.2 KiB288232

todo.mdD03-May-2024253 64

README.md

1# Android Testing in Chromium
2
3## Concepts
4  - **Native Unit Tests**: Normal Chromium unit tests based on the [gtest framework](/testing/android/docs/gtest_implementation.md). Tests for native code.
5  - **Java Unit Tests**: JUnit tests that run on the host machine using [Robolectric](http://robolectric.org) to emulate Android APIs.
6  - **Instrumentation Tests**: JUnit tests that run on Android devices (or emulators).
7    - **Unit Instrumentation Tests**: Instrumentation tests that test an individual feature. They do not require starting up ContentShell (or Chrome browser). These use [BaseActivityTestRule](https://source.chromium.org/chromium/chromium/src/+/main:base/test/android/javatests/src/org/chromium/base/test/BaseActivityTestRule.java) or [BlankUiTestActivityTestCase](https://source.chromium.org/chromium/chromium/src/+/main:ui/android/javatests/src/org/chromium/ui/test/util/BlankUiTestActivityTestCase.java) based on `BaseActivityTestRule`.
8    - **Integration Instrumentation Tests**: Instrumentation tests that bring up ContentShell (or Chrome browser) to test a certain feature in the end-to-end flow. These typically use more specialized test rules such as [ContentShellActivityTestRule](https://source.chromium.org/chromium/chromium/src/+/main:content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellActivityTestRule.java) or [ChromeActivityTestRule](https://source.chromium.org/chromium/chromium/src/+/main:chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java).
9
10## How do I...
11
12  - **set up**
13    - [... set up a device for local testing?](/testing/android/docs/android_test_instructions.md#physical-device-setup)
14    - [... set up an emulator for local testing?](/docs/android_emulator.md)
15  - **writing tests**
16    - [... write an instrumentation test?](/testing/android/docs/instrumentation.md)
17    - [... write a JUnit or Robolectric test?](/testing/android/docs/junit.md)
18    - [... write a test that needs to mock native calls?](/base/android/jni_generator/README.md#testing-mockable-natives)
19  - **running tests**
20    - [... run a gtest?](/testing/android/docs/android_test_instructions.md#gtests)
21    - [... run an instrumentation test?](/testing/android/docs/android_test_instructions.md#instrumentation-tests)
22    - [... run a JUnit test?](/testing/android/docs/android_test_instructions.md#junit-tests)
23    - [... run the Web tests?](/docs/testing/web_tests.md)
24    - [... run a telemetry test?](https://chromium.googlesource.com/catapult/+/HEAD/telemetry/README.md)
25  - **debugging tests**
26    - [... debug junit tests?](/testing/android/docs/android_test_instructions.md#junit-tests-debugging)
27    - [... debug flaky tests?](/testing/android/docs/todo.md)
28  - **miscellaneous**
29    - [... use code coverage for Java tests?](/build/android/docs/coverage.md)
30
31## How does it work on Android?
32
33  - [gtests](/testing/android/docs/gtest_implementation.md)
34  - [instrumentation tests](https://source.android.com/compatibility/tests/development/instrumentation)
35  - [junit tests](/testing/android/docs/junit.md)
36