Skip to content
Skillpedia
Testing10k · #11937

testing-setup

What it does

This skill checks how an Android project tests its code today and plans a testing setup. It can add the test libraries and harnesses for unit, UI, screenshot and end-to-end tests. It is for Android developers who want a working test strategy.

When to use it

  • ✓When your Android project has few or no tests and you want a testing setup.
  • ✓When you want to add screenshot tests for Compose or View screens.
  • ✓When you need to know which test libraries and mocking tools your project already uses.

Skill link

https://github.com/android/skills/blob/main/testing/testing-setup/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/android/skills/blob/main/testing/testing-setup/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Look at my Android project's testing setup and add the libraries for unit and Compose UI tests.”

5 new skills a week. 1 minute to read.

How it works

The skill reads your version catalog and build files to find the dependency injection framework, test frameworks, mocking tools and UI type. It then adds the missing libraries and harnesses that fit the project.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Step 1: Analyze the current testing setup

To understand the testing setup of an existing project, look for these dependencies in the libs.versions.toml file, or build files:

  1. Dependency Injection framework used. For example, Hilt, Koin, Anvil, or vanilla Dagger.
  2. Unit (local) testing framework this project uses. For example, JUnit4 or JUnit5.
  3. Mocking framework (if any) used for unit tests, and for instrumented and UI tests. For example, Mockito or Mockk.
  4. Robolectric. Identify which of these three uses apply:
    1. Used in unit tests to have fakes for platform entities
    2. To run behavior UI tests without a device or emulator. For example, used to run Espresso or Compose tests.
    3. To do screenshot testing with Roborazzi
  5. Is the app 100% Compose, Views or hybrid?
  6. Behavior UI tests:
    1. Compose Tests (androidx.compose.ui:ui-test-*)
    2. Espresso Tests for Views. Check for wrappers such as Kaspresso. Dependencies: androidx.test.espresso:espresso-core, androidx.test:runner, androidx.test:rules.
  7. Screenshot tests. Identify which of these types the project uses:
    1. Instrumented (device-based). For example, using Dropshots.
    2. Based on Robolectric, so they run locally. For example, using Roborazzi.
    3. Based on LayoutLib, so they run locally. For example, Paparazzi, or the Compose Preview Screenshot Testing tool.
  8. End to end tests (also known as Release Candidate tests) always run on device and use high-level frameworks such as UIAutomator, Appium, or Robotium.
  9. Generate a Markdown report with the analysis

Step 2: Set up Dependency Injection frameworks for testing

If there is no Dependency Injection framework, install one: if it's a multiplatform application, ask the user whether they want to install Koin, or kotlin-inject. If it's not multiplatform, install Hilt.

Install the testing dependencies (for example com.google.dagger:hilt-compiler that should be applied with a kspAndroidTest configuration).

[!IMPORTANT] Important: Always consult the documentation of the applicable framework to learn about testing (for example: Hilt testing guide, Koin Instrumented tests).

For instrumented tests, create and configure (by adding testInstrumentationRunner to the build gradle files) a new test runner and apply the testing rules required by the framework (for example in Hilt, annotate your test classes with @HiltAndroidTest and apply the HiltAndroidRule). Other frameworks use other mechanisms, consult their documentation.

Step 3: Install frameworks

Unless otherwise specified, respect the current stack of testing frameworks.

If there are no testing frameworks, and the user didn't specify any preference, install the following:

  • JUnit4 for local and instrumented tests

  • JaCoCo for test coverage

  • For UI tests: if the project has views, Espresso. If it's fully Compose, use the Compose Testing APIs.

  • Robolectric to run UI Tests

  • Compose Preview Screenshot Testing tool for screenshot tests. Check the project's AGP version first, then pick the matching setup and follow it strictly:

    • AGP 9.5.0-alpha03 or higher (recommended): configure an AGP test suite using testOptions { screenshotTests.create(...) }, as described in Screenshot testing with test suites.
    • Lower AGP versions: use the legacy standalone plugin setup with com.android.compose.screenshot, and tell the user it's deprecated. Don't upgrade AGP as part of setting up screenshot tests. Mention that test suites are available on 9.5.0-alpha03 or higher, and leave the upgrade as a separate decision.

    Don't combine both setups in the same module. If the project already uses the standalone plugin and its AGP version supports test suites, offer to migrate it using the tasks and paths mapping table in Screenshot testing with test suites.

  • Dropshots for device screenshot tests

  • If a mocking framework is necessary, install Mockk (io.mockk:mockk). Do not install it unless it is clearly necessary.

If instrumented screenshot tests are requested, install Dropshots.

If end-to-end testing is requested, install

FAQ

Does it write my actual test cases?

The skill focuses on the testing setup and harnesses, so you still decide which behaviors to test.

What kinds of screenshot tests does it know?

It recognizes device-based screenshot tests and local ones based on Robolectric or LayoutLib.

Which dependency injection tools does it recognize?

It recognizes frameworks such as Hilt, Koin, Anvil and vanilla Dagger.

Details

Original description by the author

Analyze and create a testing strategy for Android apps - install testing libraries, set up test infrastructure, create harnesses for unit tests, UI tests, screenshot tests, and end-to-end tests.

repo: android/skills

Popularity

GitHub stars
10k
Ranking position
#11937
License
Apache-2.0
Updated
10/29/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills