Skills

Testing Setup

Analyze and create a testing strategy for Android apps - install testing libraries, set...

Install

npx skills add android/skills --skill testing-setup -g -a claude-code -y
Repository
android/skills10.2k
Category
Design
Updated
6d ago
License
Complete terms in LICENSE.txt
Context cost
Mediumabout 2,452 tokens
Runs scripts
No, instructions only

What it does

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.

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).

Read the whole SKILL.md on GitHub

More in Design