Name Date Size #Lines LOC

..--

.devcontainer/H25-Apr-2025-10383

.github/H25-Apr-2025-759545

annotations/H25-Apr-2025-2,8861,779

buildSrc/H25-Apr-2025-1,075796

errorprone/H25-Apr-2025-1,205984

gradle/H25-Apr-2025-277206

images/H25-Apr-2025-

integration_tests/H25-Apr-2025-39,82530,687

junit/H25-Apr-2025-580440

nativeruntime/H25-Apr-2025-7,2274,713

pluginapi/H25-Apr-2025-709333

plugins/maven-dependency-resolver/H25-Apr-2025-1,013856

preinstrumented/H25-Apr-2025-463379

processor/H25-Apr-2025-5,5674,491

resources/H25-Apr-2025-31,75620,662

robolectric/H25-Apr-2025-135,563109,765

sandbox/H25-Apr-2025-8,3326,479

scripts/H25-Apr-2025-859645

shadowapi/H25-Apr-2025-1,5501,094

shadows/H25-Apr-2025-139,152102,581

soong/H25-Apr-2025-135101

testapp/H25-Apr-2025-1,8351,558

utils/H25-Apr-2025-4,9873,692

.gitignoreH A D25-Apr-2025552 6754

ARCHITECTURE.mdH A D25-Apr-202512.2 KiB214175

Android.bpH A D25-Apr-202513.7 KiB346323

CODE_OF_CONDUCT.mdH A D25-Apr-20253.2 KiB7556

LICENSEH A D25-Apr-202512.6 KiB234192

METADATAH A D25-Apr-2025307 1615

MODULE_LICENSE_MITHD25-Apr-20250

NOTICEH A D25-Apr-20251.1 KiB2217

OWNERSH A D25-Apr-202584 54

README.mdH A D25-Apr-20252.9 KiB7146

WORKSPACEH A D25-Apr-202536 11

build.gradle.ktsH A D25-Apr-20257.1 KiB223185

gradle.propertiesH A D25-Apr-2025714 2014

gradlewH A D25-Apr-20258.6 KiB253105

gradlew.batH A D25-Apr-20252.9 KiB9573

harddiff.shH A D25-Apr-20251.2 KiB5540

settings.gradle.ktsH A D25-Apr-20251.5 KiB6560

README.md

1<a name="README">[<img src="https://rawgithub.com/robolectric/robolectric/master/images/robolectric-horizontal.png"/>](https://robolectric.org)</a>
2
3[![Build Status](https://github.com/robolectric/robolectric/actions/workflows/tests.yml/badge.svg)](https://github.com/robolectric/robolectric/actions?query=workflow%3Atests)
4[![GitHub release](https://img.shields.io/github/release/robolectric/robolectric.svg?maxAge=60)](https://github.com/robolectric/robolectric/releases)
5
6Robolectric is the industry-standard unit testing framework for Android. With Robolectric, your tests run in a simulated Android environment inside a JVM, without the overhead and flakiness of an emulator. Robolectric tests routinely run 10x faster than those on cold-started emulators.
7
8Robolectric supports running unit tests for *14* different versions of Android, ranging from Lollipop (API level 21) to U (API level 34).
9
10## Usage
11
12Here's an example of a simple test written using Robolectric:
13
14```java
15@RunWith(AndroidJUnit4.class)
16public class MyActivityTest {
17
18  @Test
19  public void clickingButton_shouldChangeResultsViewText() {
20    Activity activity = Robolectric.setupActivity(MyActivity.class);
21
22    Button button = (Button) activity.findViewById(R.id.press_me_button);
23    TextView results = (TextView) activity.findViewById(R.id.results_text_view);
24
25    button.performClick();
26    assertThat(results.getText().toString(), equalTo("Testing Android Rocks!"));
27  }
28}
29```
30
31For more information about how to install and use Robolectric on your project, extend its functionality, and join the community of contributors, please visit [robolectric.org](https://robolectric.org).
32
33## Install
34
35### Starting a New Project
36
37If you'd like to start a new project with Robolectric tests, you can refer to `deckard` (for either [Maven](https://github.com/robolectric/deckard-maven) or [Gradle](https://github.com/robolectric/deckard-gradle)) as a guide to setting up both Android and Robolectric on your machine.
38
39### `build.gradle`
40
41```groovy
42testImplementation "junit:junit:4.13.2"
43testImplementation "org.robolectric:robolectric:4.13"
44```
45
46## Building and Contributing
47
48Robolectric is built using Gradle. Both Android Studio and IntelliJ can import the top-level `build.gradle.kts` file and will automatically generate their project files from it.
49
50To get Robolectric up and running on your machine, check out
51[this guide](https://robolectric.org/building-robolectric/).
52
53To get a high-level overview of Robolectric's architecture, check out
54[ARCHITECTURE.md](ARCHITECTURE.md).
55
56## Using Snapshots
57
58If you would like to live on the bleeding edge, you can try running against a snapshot build. Keep in mind that snapshots represent the most recent changes on the `master` and may contain bugs.
59
60### `build.gradle`
61
62```groovy
63repositories {
64    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
65}
66
67dependencies {
68    testImplementation "org.robolectric:robolectric:4.14-SNAPSHOT"
69}
70```
71