Sign in Get 3 free credits

Try a job or a niche: tiktok captions, study notes, excel formulas. Press Esc to close.

Compose test entry points

Picks the right Compose UI test rule or runComposeUiTest setup for each case, so tests avoid mixed setup bugs.

Claude's review

8/10 Precise Compose test entry point choice with v1 v2 deprecation and never mix rule

We asked Claude the question you would ask: would I be glad I installed this? We only sell skills it rates 7 or higher.

In detail

Use this skill to pick the correct Compose UI test entry point. Compares `createComposeRule()`, `createAndroidComposeRule<A>()`, `createEmptyComposeRule()`, `runComposeUiTest { }`, and `runAndroidComposeUiTest<A> { }`, plus the v1 vs v2 split (`UnconfinedTestDispatcher` vs `StandardTestDispatcher`). Encodes the rule that mixing `runComposeUiTest { }` and a `ComposeTestRule` in the same test is forbidden, that `setContent` may only run once, and that `createEmptyComposeRule()` returns `ComposeTestRule` (no `setContent`). Use when the user asks "ComposeTestRule vs ComposeUiTest", reports `IllegalStateException: setContent can only be called once`, mentions `runComposeUiTest`, the v2 deprecation warning, `effectContext`, custom `ComponentActivity`, or "host tests need a coroutine scope".

How you use it

  1. Add it to your pack, then download your pack (1 credit).
  2. In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
  3. Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide

Safety check

Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.

An automated scan lowers risk but cannot promise zero risk. How we check skills

Preview

The first lines of SKILL.md
---
name: choosing-test-rule-vs-runtest
description: >-
  Use this skill to pick the correct Compose UI test entry point. Compares `createComposeRule()`, `createAndroidComposeRule<A>()`, `createEmptyComposeRule()`, `runComposeUiTest { }`, and `runAndroidComposeUiTest<A> { }`, plus the v1 vs v2 split (`UnconfinedTestDispatcher` vs `StandardTestDispatcher`). Encodes the rule that mixing `runComposeUiTest { }` and a `ComposeTestRule` in the same test is forbidden, that `setContent` may only run once, and that `createEmptyComposeRule()` returns `ComposeTestRule` (no `setContent`). Use when the user asks "ComposeTestRule vs ComposeUiTest", reports `IllegalStateException: setContent can only be called once`, mentions `runComposeUiTest`, the v2 deprecation warning, `effectContext`, custom `ComponentActivity`, or "host tests need a coroutine scope".
license: Apache-2.0. See LICENSE for complete terms.
metadata:
  author: Jaewoong Eum (skydoves)
  keywords:
  - jetpack-compose
  - ui-testing
  - createComposeRule
  - createAndroidComposeRule
  - createEmptyComposeRule
  - runComposeUiTest
  - ComposeTestRule
  - ComposeUiTest
  - v2-test-api
  - StandardTestDispatcher
  - effect-context
---

# Choosing Test Rule vs runComposeUiTest — One Entry Point Per Test

Compose ships two parallel test entry points: a JUnit4 `TestRule` (`createComposeRule()` and friends) and a multiplatform suspending lambda (`runComposeUiTest { }`). Each one independently sets up the recomposer, `MainTestClock`, and `IdlingResource`. Mixing them in a single test produces double-environment bugs that are hard to diagnose. This skill picks the right one and surfaces the v1 → v2 deprecation that bites every existing codebase.

## When to use this skill

- The user is starting a new Compose UI test and is choosing between `createComposeRule()` and `runComposeUiTest { }`.
- The IDE shows a deprecation `WARNING` on `import androidx.compose.ui.test.junit4.createComposeRule` or `import androidx.compose.ui.test.runComposeUiTest`.
- The user reports tests passing on v1 entry points but breaking after migrating because `LaunchedEffect`s no longer run synchronously.
- The user has a custom `ComponentActivity` subclass and is unsure between `createAndroidComposeRule` and `createEmptyComposeRule`.
- The user reports `IllegalStateException: setContent can only be called once per ComposeTestRule` or "the launched Activity already calls setContent".
- The user is writing Compose Multiplatform (KMP) tests and needs the suspending entry point.

## When NOT to use this skill

- The dependencies do not yet compile — start with `./configuring-test-dependencies/SKILL.md`.
- The choice is host vs device, not rule vs lambda — see `./setting-up-host-vs-device-tests/SKILL.md`.
- The test compiles and runs but flakes on idle/animation — see `../../synchronization/synchronizing-with-idle/SKILL.md` and `../../synchronization/testing-animations-deterministically/SKILL.md`.

...

From skydoves's repository, Apache-2.0 licence.

Related skills

  • Checked

    React Native tests

    Writes and fixes React Native component tests with Testing Library v13 and v14, using the right API for each.

    by callstackincubator 1.7k
    7/101 credit
  • Checked

    JUnit and Mockito tests

    Writes and fixes Java tests with JUnit, AssertJ and Mockito that are deterministic and keep failures visible.

    by github 42k
    8/101 credit
  • Checked

    Test code review

    Reviews new or changed tests in pytest, Jest, Go and more, so weak tests are caught before merge.

    by amElnagdy 1.3k
    8/101 credit
  • Checked

    Test scope decisions

    Decides which tests a change needs and how to judge their quality, for unit, integration and UI tests.

    by shinpr 725
    8/101 credit
  • Checked

    Playwright accessibility tests

    Writes Playwright and axe tests for WCAG, focus and ARIA, so accessibility bugs fail the build early.

    by fugazi 273
    7/101 credit
  • Checked

    Go table driven tests

    Writes Go tests with table cases, fakes, fuzzing, benchmarks and golden files that stay fast and reliable.

    by ericrisco 691
    8/101 credit

Secure checkout

Credits

AUD

  1. 1Choose
  2. 2Pay on Square
  3. 3Credits added