[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-4342":3},{"id":4,"name":5,"fullName":6,"owner":5,"repo":5,"description":7,"homepage":8,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":16,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":30,"discoverSource":31},4342,"robolectric","robolectric\u002Frobolectric","Android Unit Testing Framework","https:\u002F\u002Frobolectric.org",null,"Java",6013,1382,189,400,0,2,7,40.42,"Other",false,"master",true,[24,25,5,26],"android","java","unit-testing","2026-06-12 02:01:02","\u003Ca name=\"README\">\u003C\u002Fa>\n[![robolectric logo](https:\u002F\u002Fraw.githubusercontent.com\u002Frobolectric\u002Frobolectric\u002Fmaster\u002Fimages\u002Frobolectric-horizontal.png)](https:\u002F\u002Frobolectric.org)\n\n[![Build Status](https:\u002F\u002Fgithub.com\u002Frobolectric\u002Frobolectric\u002Factions\u002Fworkflows\u002Ftests.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Frobolectric\u002Frobolectric\u002Factions?query=workflow%3Atests)\n[![GitHub release](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Frobolectric\u002Frobolectric.svg?maxAge=60)](https:\u002F\u002Fgithub.com\u002Frobolectric\u002Frobolectric\u002Freleases)\n\nRobolectric 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.\n\nRobolectric supports running unit tests for *14* different versions of Android, ranging from M (API level 23) to Baklava (API level 36).\n\n## Usage\n\nTo use Robolectric in your project, simply add the necessary dependencies to your module's `build.gradle`\u002F`build.gradle.kts` file:\n\n```groovy\ntestImplementation(\"junit:junit:4.13.2\")\ntestImplementation(\"org.robolectric:robolectric:4.16.1\")\ntestImplementation(\"androidx.test.ext:junit:1.3.0\")\n```\n\nThen you can write your tests using Robolectric, like the following example:\n\n```java\n@RunWith(AndroidJUnit4.class)\npublic class MyActivityTest {\n  @Test\n  public void clickingButton_shouldChangeMessage() {\n    try (ActivityController\u003CMyActivity> controller = Robolectric.buildActivity(MyActivity.class)) {\n      controller.setup(); \u002F\u002F Moves the Activity to the RESUMED state\n      MyActivity activity = controller.get();\n\n      activity.findViewById(R.id.button).performClick();\n      assertEquals(((TextView) activity.findViewById(R.id.text)).getText(), \"Robolectric Rocks!\");\n    }\n  }\n}\n```\n\nFor more information about how to install and use Robolectric in your project, extend its functionality, and join the community of contributors, you can visit [robolectric.org](https:\u002F\u002Frobolectric.org).\n\n## Building and Contributing\n\nRobolectric 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.\n\nTo get Robolectric up and running on your machine, check out\n[this guide](https:\u002F\u002Frobolectric.org\u002Fbuilding-robolectric\u002F).\n\nTo get a high-level overview of Robolectric's architecture, check out\n[robolectric.org](https:\u002F\u002Frobolectric.org\u002Farchitecture).\n\n## Development model\n\nRobolectric is actively developed in several locations. The primary location is\nthis GitHub repository, which is considered the *source-of-truth* for\nRobolectric code. It is where contributions from the broader Android developer\ncommunity occur. There is also an active development tree of Robolectric\ninternally at Google, where contributions from first-party Android developers\noccur. By having a development tree of Robolectric internally at Google, it\nenables first-party Android developers to more efficiently make contributions\nto Robolectric. This tree is synced directly to the [`google`\nbranch](https:\u002F\u002Fgithub.com\u002Frobolectric\u002Frobolectric\u002Ftree\u002Fgoogle) every\ntime a change occurs using the [`Copybara`](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcopybara)\ncode sync tool. Bidirectional merges of this branch and the\n[`master`](https:\u002F\u002Fgithub.com\u002Frobolectric\u002Frobolectric\u002Ftree\u002Fmaster) branch occur\nregularly.\n\nRobolectric also has usage in the Android platform via the\n[external\u002Frobolectric](https:\u002F\u002Fcs.android.com\u002Fandroid\u002Fplatform\u002Fsuperproject\u002Fmain\u002F+\u002Fmain:external\u002Frobolectric\u002F)\nrepo project. Contributions to this source tree are typically related to new\nSDK support and evolving platform APIs. Changes from this branch are upstreamed\nto the internal Robolectric tree at Google, which eventually propagate to the\nGitHub branches.\n\nAlthough complex, this distributed development model enables Android developers\nin different environments to use and contribute to Robolectric, while allowing\nchanges to eventually make their way to public Robolectric releases.\n\n> [!TIP]\n> You can trigger the\n> [`sync_google_master`](https:\u002F\u002Fgithub.com\u002Frobolectric\u002Frobolectric\u002Factions\u002Fworkflows\u002Fsync_google_master.yml)\n> workflow to create a PR to sync the `google` branch into `master`.\n\n## Using Snapshots\n\nIf 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.\n\n### `build.gradle`\n\n```groovy\nrepositories {\n    maven { url \"https:\u002F\u002Fcentral.sonatype.com\u002Frepository\u002Fmaven-snapshots\u002F\" }\n}\n\ndependencies {\n    testImplementation \"org.robolectric:robolectric:4.17-SNAPSHOT\"\n}\n```\n","Robolectric是一个专为Android应用设计的单元测试框架。它允许开发者在JVM中模拟Android环境运行测试，无需依赖于缓慢且不稳定的模拟器，从而显著提高测试效率和稳定性。Robolectric支持从API 23到API 36共14个版本的Android系统，确保了广泛的兼容性。其核心优势在于能够快速执行测试（比冷启动模拟器快10倍左右），并且通过提供丰富的API来模拟Android SDK的行为，使得针对UI组件、数据库访问等复杂场景的测试变得更加容易。非常适合需要高效进行Android应用开发与维护的团队使用。","2026-06-11 02:59:43","top_language"]