More
2 files changed
tree: aa1e9676342390c3ed8fd4dc217095b3d101bfbd
  1. .bcr/
  2. .github/
  3. bazel/
  4. examples/
  5. .bazelignore
  6. .bazelrc
  7. .bazelversion
  8. .gitignore
  9. CONTRIBUTING.md
  10. MODULE.bazel
  11. README.md
  12. WORKSPACE
  13. WORKSPACE.bzlmod
README.md

robolectric-bazel

This project provides build rules for integrating Robolectric into Bazel projects.

Releases


Installation

Follow instructions in the release notes from the release you use: https://github.com/robolectric/robolectric-bazel/releases

Usage

In your android_local_test targets in the BUILD files, depend on the Robolectric targets @maven//:org_robolectric_robolectric and @robolectric//bazel:android-all:

android_local_test(
    name = "greeter_activity_test",
    srcs = ["GreeterTest.java"],
    manifest = "TestManifest.xml",
    test_class = "com.example.bazel.GreeterTest",
    deps = [
        ":greeter_activity",
        "@maven//:org_robolectric_robolectric",
        "@robolectric//bazel:android-all",
    ],
)