choosing-test-rule-vs-runtest

Community

Pick the right Compose UI test entry point.

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 suspending runComposeUiTest { }/runAndroidComposeUiTest<A> { }/runEmptyComposeUiTest { } APIs.
  • Avoid common breaking patterns: ensure you do not mix the rule-based ComposeTestRule environment with the lambda-based ComposeUiTest environment in the same test.
  • Fix setContent and activity-launch edge cases: call setContent exactly 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 StandardTestDispatcher to 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 required

Components

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.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.