📸
AndroidUiTestingUtils
  • Overview
  • Setup
    • Instrumentation setup
    • Robolectric setup
    • Cross-Library setup
  • Usage
    • Instrumentation tests usage
      • Android-Testify usage
    • Robolectric usage
    • Cross-Library usage
    • TestRules & other utils
  • Ready-to-Run Samples
  • Github
Powered by GitBook
On this page
  1. Setup

Robolectric setup

PreviousInstrumentation setupNextCross-Library setup

Last updated 1 year ago

Robolectric supports screenshot testing via since 4.10, and libraries like rely on it.

With AndroidUiTestingUtils, you can configure your Robolectric screenshot tests similar to how you'd do it with on-device tests!

Moreover, it offers some utility methods to generate Robolectric screenshot tests for different screen sizes and configurations.

For that, add the following dependencies in your build.gradle:

// Available from version 2.0.0+
testImplementation 'com.github.sergio-sastre.AndroidUiTestingUtils:utils:<version>'
testImplementation 'com.github.sergio-sastre.AndroidUiTestingUtils:robolectric:<version>'

Application Modules

If you get any error due to "Activity not found" in your application module, add the following to your debug/manifest

<activity android:name="sergio.sastre.uitesting.robolectric.activityscenario.RobolectricActivityScenarioConfigurator$SnapshotConfiguredActivity"/>
Robolectric Native graphics (RNG)
Roborazzi,