choosing-test-rule-vs-runtest
CommunityPick the right Compose UI test entry point.
Software Engineering#jetpack-compose#ui-testing#v2-api#ComposeTestRule#runComposeUiTest#setContent#coroutines-test
Authorskydoves
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This skill prevents Compose UI tests from failing or behaving inconsistently by helping you choose the correct test entry point and avoiding forbidden mixes of environments.
Core Features & Use Cases
- Choose the correct Compose UI test entry point: decide between JUnit4
createComposeRule()/createAndroidComposeRule<A>()/createEmptyComposeRule()and the suspendingrunComposeUiTest { }/runAndroidComposeUiTest<A> { }/runEmptyComposeUiTest { }APIs. - Avoid common breaking patterns: ensure you do not mix the rule-based
ComposeTestRuleenvironment with the lambda-basedComposeUiTestenvironment in the same test. - Fix
setContentand activity-launch edge cases: callsetContentexactly once per test (and never call it via the rule when the launched Activity already sets Compose content). - Prefer v2 for new code: select the v2 imports that use
StandardTestDispatcherto match coroutine scheduling expectations, and address v1-to-v2 behavior changes.
Quick Start
Use this skill to map your intended test setup to the correct Compose UI testing API and confirm the right v2 imports and constraints for setContent and environment mixing.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: choosing-test-rule-vs-runtest Download link: https://github.com/skydoves/android-testing-skills/archive/main.zip#choosing-test-rule-vs-runtest Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.