organizing-test-source-sets

Installation
SKILL.md

Organizing Test Source Sets — src/test/, src/androidTest/, and the KMP Split

Where a test file lives determines which JVM runs it, which dependencies it sees, and whether it ships in the test APK. Most modules need only src/test/ and src/androidTest/. Modules that share helpers between host and device tests historically used src/sharedTest/ (a Codelab convention, not Google-documented as such), which broke on AGP 7.2+ and pushed Compose itself to the KMP-style androidHostTest / androidDeviceTest split. This skill encodes the matrix so the agent can place a test file with confidence.

When to use this skill

  • The user asks "where do I put my tests" or "src/test/ or src/androidTest/".
  • The user asks "what's testImplementation vs androidTestImplementation vs debugImplementation".
  • The user reports Unresolved reference: createComposeRule and the agent suspects the dependency is on the wrong configuration.
  • The user is migrating off src/sharedTest/ after AGP 7.2+ broke their sourceSets { test.java.srcDir(...) } block.
  • The user mentions androidHostTest / androidDeviceTest and asks how to set them up in a non-KMP module.
  • The user asks "why is my Robolectric test in src/androidTest/" — it should be in src/test/.

When NOT to use this skill

  • The user is wiring Gradle dependencies for Compose test (ui-test-junit4, ui-test-manifest) — use ../../../compose/setup/configuring-test-dependencies/SKILL.md.
  • The user is choosing test scope (small/medium/big) — use ../../concepts/understanding-the-testing-pyramid/SKILL.md.
  • The user is configuring AndroidJUnitRunner itself — use ../../../instrumentation/runner/running-instrumented-tests-with-androidjunit4/SKILL.md.
  • The user is configuring a JUnit4 runner for JVM tests — use ../../../jvm-tests/runner/configuring-junit4-on-android/SKILL.md.
Installs
37
GitHub Stars
319
First Seen
May 16, 2026
organizing-test-source-sets — skydoves/android-testing-skills