All Projects → robolectric → Robolectric

robolectric / Robolectric

Licence: other
Android Unit Testing Framework

Programming Languages

java
68154 projects - #9 most used programming language
C++
36643 projects - #6 most used programming language
groovy
2714 projects
shell
77523 projects
c
50402 projects - #5 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to Robolectric

Androidunittest
Save time & clear your unit tests on Android !
Stars: ✭ 205 (-96.18%)
Mutual labels:  unit-testing, robolectric
Test Smells
Test Smells for Android developers
Stars: ✭ 120 (-97.77%)
Mutual labels:  unit-testing, robolectric
Sample Code Movies
This repository contains sample code. Its purpose being, to quickly demonstrate Android and software development in general, clean code, best practices, testing and all those other must know goodies.
Stars: ✭ 81 (-98.49%)
Mutual labels:  unit-testing, robolectric
EasyUtAndroid
Android unit testing example 全面的android应用单元测试方法及案例
Stars: ✭ 21 (-99.61%)
Mutual labels:  unit-testing, robolectric
Cmake Examples
Useful CMake Examples
Stars: ✭ 7,220 (+34.4%)
Mutual labels:  unit-testing
Vunit
VUnit is a unit testing framework for VHDL/SystemVerilog
Stars: ✭ 438 (-91.85%)
Mutual labels:  unit-testing
Bash unit
bash unit testing enterprise edition framework for professionals
Stars: ✭ 419 (-92.2%)
Mutual labels:  unit-testing
Bunit
A testing library for Blazor Components. You can easily define components under test in C# or Razor syntax and verify outcome using semantic HTML diffing/comparison logic. You can easily interact with and inspect components, trigger event handlers, provide cascading values, inject services, mock IJSRuntime, and perform snapshot testing.
Stars: ✭ 415 (-92.27%)
Mutual labels:  unit-testing
Kotlin Coroutines Android Examples
Learn Kotlin Coroutines for Android by Examples. Learn how to use Kotlin Coroutines for Android App Development.
Stars: ✭ 572 (-89.35%)
Mutual labels:  unit-testing
Jasmine Matchers
Write Beautiful Specs with Custom Matchers for Jest and Jasmine
Stars: ✭ 552 (-89.72%)
Mutual labels:  unit-testing
Expecto
A smooth testing lib for F#. APIs made for humans! Strong testing methodologies for everyone!
Stars: ✭ 495 (-90.79%)
Mutual labels:  unit-testing
Service Pattern Go
Simple clean Go REST API architecture with dependency injection and mocking example, following SOLID principles.
Stars: ✭ 449 (-91.64%)
Mutual labels:  unit-testing
Ut
UT: C++20 μ(micro)/Unit Testing Framework
Stars: ✭ 507 (-90.56%)
Mutual labels:  unit-testing
Clicker
Ionic 2 + @angular/cli Seed Project : Angular2 + Typescript + Karma + Protractor + Travis
Stars: ✭ 439 (-91.83%)
Mutual labels:  unit-testing
Java Dns Cache Manipulator
🌏 A simple 0-dependency thread-safe Java™ lib/tool for setting dns programmatically without touching host file, make unit/integration test portable.
Stars: ✭ 557 (-89.63%)
Mutual labels:  unit-testing
Androidut
Android开发中必要的一环---单元测试(Unit Test)
Stars: ✭ 419 (-92.2%)
Mutual labels:  robolectric
System Rules
A collection of JUnit rules for testing code which uses java.lang.System.
Stars: ✭ 492 (-90.84%)
Mutual labels:  unit-testing
Platformio Core
PlatformIO is a professional collaborative platform for embedded development 👽 A place where Developers and Teams have true Freedom! No more vendor lock-in!
Stars: ✭ 5,539 (+3.11%)
Mutual labels:  unit-testing
Xctesthtmlreport
Xcode-like HTML report for Unit and UI Tests
Stars: ✭ 489 (-90.9%)
Mutual labels:  unit-testing
Codeception
Full-stack testing PHP framework
Stars: ✭ 4,401 (-18.08%)
Mutual labels:  unit-testing

Build Status GitHub release

Robolectric 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.

Robolectic supports running unit tests for 15 different versions of Android, ranging from Jelly Bean (API level 16) to S (API level 31).

Usage

Here's an example of a simple test written using Robolectric:

@RunWith(AndroidJUnit4.class)
public class MyActivityTest {

  @Test
  public void clickingButton_shouldChangeResultsViewText() throws Exception {
    Activity activity = Robolectric.setupActivity(MyActivity.class);

    Button button = (Button) activity.findViewById(R.id.press_me_button);
    TextView results = (TextView) activity.findViewById(R.id.results_text_view);

    button.performClick();
    assertThat(results.getText().toString(), equalTo("Testing Android Rocks!"));
  }
}

For more information about how to install and use Robolectric on your project, extend its functionality, and join the community of contributors, please visit http://robolectric.org.

Install

Starting a New Project

If you'd like to start a new project with Robolectric tests you can refer to deckard (for either maven or gradle) as a guide to setting up both Android and Robolectric on your machine.

build.gradle:

testImplementation "org.robolectric:robolectric:4.7.3"

Building And Contributing

Robolectric is built using Gradle. Both IntelliJ and Android Studio can import the top-level build.gradle file and will automatically generate their project files from it.

Robolectric supports running tests against multiple Android API levels. The work it must do to support each API level is slightly different, so its shadows are built separately for each. To build shadows for every API version, run:

./gradlew clean assemble testClasses --parallel

Using Snapshots

If 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 master and may contain bugs.

build.gradle:

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

dependencies {
    testImplementation "org.robolectric:robolectric:4.8-SNAPSHOT"
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].