# /testing-setup: Set up a complete testing strategy for an Android app

Source: https://trendhub.net/skills/android-skills/testing-setup
Skill folder: https://github.com/android/skills/tree/main/testing/testing-setup
Pack: Android Skills (https://trendhub.net/skills/android-skills)
Works with: Android CLI (detected agents), Claude Code, Codex

testing-setup starts by mapping what an app already uses for dependency injection, unit, UI, screenshot and end-to-end tests, and writes that up as a report. It then fills the gaps with a default stack when nothing is chosen, refactors code behind fakes, and adds tests layer by layer, from ViewModels and databases to window sizes, navigation and device screenshots.

## When to use it

- An Android app has few or no automated tests.
- You want screenshot tests across window sizes and font scales.
- You are unsure which testing libraries a project already relies on.

## How it works

1. **Analyse the setup**: The agent inspects version catalogs and build files for DI, unit, mocking, Robolectric, UI, screenshot and end-to-end frameworks and writes a report.
2. **Install what is missing**: It respects the existing stack and otherwise adds Hilt, JUnit4, Robolectric, Compose or Espresso tests, Compose Preview screenshot testing, Dropshots and JaCoCo.
3. **Refactor for fakes**: Framework dependencies are put behind interfaces with fakes in the test source set, using mocks only where fakes are impossible.
4. **Write tests by layer**: Unit tests cover business logic, Robolectric runs UI tests, Room gets in-memory instrumented tests and screens get screenshots at nine sizes.
5. **Document**: If you agree, it records the strategy in AGENTS.md or a new docs/testing.md with the commands for each test type.

## What it steers the agent away from

- Writing unit tests for Activities, layouts or DI configuration.
- Installing a mocking library when fakes would do.
- Upgrading AGP just to set up screenshot tests.

## What it can touch

It edits Gradle files and source code, adds test source files and test runners, and may create AGENTS.md or docs/testing.md with your consent.

## Pairs well with

- `/android-cli`
- `/migrate-xml-views-to-jetpack-compose`

## Questions

### Will it replace my current test libraries?

No. Unless told otherwise it keeps the frameworks the project already uses and only installs defaults where nothing exists.

### How many end-to-end tests does it add?

A small number, around five percent of all tests, covering major user journeys.
