# Robolectric setup

Robolectric supports screenshot testing via [Robolectric Native graphics (RNG)](https://github.com/robolectric/robolectric/releases/tag/robolectric-4.10) since 4.10, and libraries like [Roborazzi,](https://github.com/takahirom/roborazzi) rely on it.

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

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`:

```groovy
// 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`

```xml
<activity android:name="sergio.sastre.uitesting.robolectric.activityscenario.RobolectricActivityScenarioConfigurator$SnapshotConfiguredActivity"/>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sergio-sastre.gitbook.io/androiduitestingutils/setup/robolectric-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
