3
0
Fork 0
android_frameworks_base/ravenwood
Filip Zakrzewski 08870f6cbb Add automotive_code_coverage keyword to Car host unit tests
This change will allow to run Code Coverage invocations for Car only tests

BUG=367371818
Flag: TEST_ONLY

Change-Id: I09daab1cffaeaf66a230c53d3ee8635ad12719fc
2024-09-20 18:36:33 +00:00
..
annotations-src/android/ravenwood/annotation Allow to add a bug number to ravenwood annotations 2024-09-12 17:10:02 -07:00
bivalenttest [Ravenwood] Always initialize Ravenwood environment 2024-09-16 23:57:02 +00:00
empty-res [Ravenwood] Add an empty resources module 2024-09-13 20:52:20 +00:00
framework-src/android/ravenwood/example
junit-flag-src/android/platform/test/flag/junit
junit-impl-src/android/platform/test/ravenwood Hook up "instrumentation resources" 2024-09-19 02:00:20 +00:00
junit-src/android/platform/test Merge "Fix another NPE in RATR.run()" into main 2024-09-20 18:26:52 +00:00
junit-stub-src/android/platform/test/ravenwood [Ravenwood] Load native code without class load hook 2024-09-16 23:57:02 +00:00
minimum-test Change tests' package names 2024-08-19 12:18:28 -07:00
mockito Make java_sdk_library dependencies explicit 2024-09-11 00:15:14 +00:00
resapk_test Change tests' package names 2024-08-19 12:18:28 -07:00
runtime-common-device-src/com/android/ravenwood/common/divergence
runtime-common-ravenwood-src/com/android/ravenwood/common/divergence
runtime-common-src/com/android/ravenwood/common Hook up "instrumentation resources" 2024-09-19 02:00:20 +00:00
runtime-helper-src [Ravenwood] Load native code without class load hook 2024-09-16 23:57:02 +00:00
runtime-jni Clean up log initialization 2024-09-05 15:34:46 -07:00
runtime-test Change tests' package names 2024-08-19 12:18:28 -07:00
scripts Move SystemUiRavenTests to postsubmit 2024-09-12 16:48:56 -07:00
services-test [Ravenwood] Support context.getResources() without res APK 2024-08-24 08:40:02 +00:00
tests Merge "Fix another NPE in RATR.run()" into main 2024-09-20 18:26:52 +00:00
texts [HostStubGen] Introduce new feature: method redirection 2024-09-05 23:30:45 +00:00
tools/ravenizer Make Ravenizer less verbose 2024-09-13 10:49:16 -07:00
.gitignore Add all ravenwood tests as presubmit 2024-08-29 11:56:03 -07:00
Android.bp Merge "Include compat-config XMLs in ravenwood-runtime" into main am: 61b8dd11e7 am: 1b7f45a155 2024-09-17 19:33:30 +00:00
OWNERS Add omakoto@ to OWNERS file. 2024-09-12 16:18:33 +00:00
README.md
TEST_MAPPING Add automotive_code_coverage keyword to Car host unit tests 2024-09-20 18:36:33 +00:00
api-maintainers.md
test-authors.md Updated reference to DisabledOnRavenwood. 2024-07-23 06:03:04 +00:00

README.md

Ravenwood

Ravenwood is an officially-supported lightweight unit testing environment for Android platform code that runs on the host.

Ravenwoods focus on Android platform use-cases, improved maintainability, and device consistency distinguishes it from Robolectric, which remains a popular choice for app testing.

Background

Executing tests on a typical Android device has substantial overhead, such as flashing the build, waiting for the boot to complete, and retrying tests that fail due to general flakiness.

In contrast, defining a lightweight unit testing environment mitigates these issues by running directly from build artifacts (no flashing required), runs immediately (no booting required), and runs in an isolated environment (less flakiness).

Guiding principles

Heres a summary of the guiding principles for Ravenwood, aimed at addressing Robolectric design concerns and better supporting Android platform developers:

  • API support for Ravenwood is opt-in. Teams that own APIs decide exactly what, and how, they support their API functionality being available to tests. When an API hasnt opted-in, the API signatures remain available for tests to compile against and/or mock, but they throw when called under a Ravenwood environment.
    • Contrasted with Robolectric which attempts to run API implementations as-is, causing maintenance pains as teams maintain or redesign their API internals.
  • API support and customizations for Ravenwood appear directly inline with relevant code. This improves maintenance of APIs by providing awareness of what code runs under Ravenwood, including the ability to replace code at a per-method level when Ravenwood-specific customization is needed.
    • Contrasted with Robolectric which maintains customized behavior in separate “Shadow” classes that are difficult for maintainers to be aware of.
  • APIs supported under Ravenwood are tested to remain consistent with physical devices. As teams progressively opt-in supporting APIs under Ravenwood, were requiring they bring along “bivalent” tests (such as the relevant CTS) to validate that Ravenwood behaves just like a physical device.
    • Contrasted with Robolectric, which has limited (and forked) testing of their environment, increasing their risk of accidental divergence over time and misleading “passing” signals.
  • Ravenwood aims to support more “real” code. As API owners progressively opt-in their code, they have the freedom to provide either a limited “fake” that is a faithful emulation of how a device behaves, or they can bring more “real” code that runs on physical devices.
    • Contrasted with Robolectric, where support for “real” code ends at the app process boundary, such as a call into system_server.

More details