configuring-test-dependencies
Installation
SKILL.md
Configuring Test Dependencies — Get the Gradle Matrix Right
Compose UI tests fail at the dependency layer in three predictable ways: the JUnit4 surface is on the wrong source set, the ui-test-manifest artifact is missing or on the wrong configuration, or the host-test trio is incomplete. This skill encodes the exact matrix and the lint warning that polices it. Subsequent skills (choosing-test-rule-vs-runtest/SKILL.md, setting-up-host-vs-device-tests/SKILL.md) assume the dependencies are correct.
When to use this skill
- The user reports
java.lang.RuntimeException: Could not launch activity within 45 seconds. Examined activities: ... androidx.activity.ComponentActivityorActivityNotFoundException. - The IDE flags
createComposeRuleas unresolved orimport androidx.compose.ui.test.junit4.createComposeRuleas red. - Lint surfaces
TestManifestGradleConfiguration(severity WARNING) on abuild.gradle.ktsline. - The user wants to add Robolectric / host (JVM) tests for Compose and asks which artifacts to depend on.
- The user wants to opt into
enableAccessibilityChecks(...)and is unsure which artifact owns it.
When NOT to use this skill
- Dependencies are already correct and the user is choosing between
createComposeRule()andrunComposeUiTest { }— use./choosing-test-rule-vs-runtest/SKILL.md. - Dependencies compile but the test runs in the wrong source set (
test/vsandroidTest/) — use./setting-up-host-vs-device-tests/SKILL.md. - The test compiles and runs but is flaky/timing-out — start with
../../synchronization/synchronizing-with-idle/SKILL.md.