Buck: robolectric_test()
Support Ukraine. Help Provide Humanitarian Aid to Ukraine.


A robolectric_test() rule is used to define a set of .java files that contain tests to run via JUnit with Robolectric test runner. It extends from java_test() rule.


  • name (required) #

    The short name for this build target.

  • robolectric_runtime_dependency (defaults to None) #

    Robolectric only runs in offline mode with buck. Specify the relative directory containing all the jars Robolectric uses at runtime.

  • robolectric_manifest (defaults to None) #

    An optional Android Manifest for the rule to declare any permissions or intents it may need or want to handle. May either be a file or a android_manifest target.

  • force_final_resource_ids (defaults to True) #

    Set it to false if using Robolectric version greater than 3.2 or higher as Robolectric requires resources id's to be non final.

  • contacts (defaults to []) #

    A list of organizational contacts for this test. These could be individuals who you would contact in the event of a test failure or other issue with the test.

    contacts = [ 'Joe Sixpack', 'Erika Mustermann' ]

  • free_compiler_args (defaults to []) #

    List of additional arguments to pass into the Kotlin compiler.

  • use_binary_resources (defaults to False) #

    Tells Robolectric to use binary resources mode, which reads resources from a resource APK rather than the filesystem. This requires Robolectric 4+.

  • visibility (defaults to []) #

    List of build target patterns that identify the build rules that can include this rule as a dependency, for example, by listing it in their deps or exported_deps attributes. For more information, see visibility.

  • licenses (defaults to []) #

    Set of license files for this library. To get the list of license files for a given build rule and all of its dependencies, you can use buck query.

  • labels (defaults to []) #

    Set of arbitrary strings which allow you to annotate a build rule with tags that can be searched for over an entire dependency tree using buck query attrfilter().