Turn an app's approved CUJs into test cases an agent can run on the real phone through CodeDroid - preconditions, steps by exact label, an observation rubric (baseline, expected, fail if, inconclusive if), cleanup and its check, with negative cases for each feature's gates and harmful controls - into e2e/TESTCASES.md. Use as step 4 of app-e2e, when asked to write or plan test cases, or when e2e cases are flaky, pass by accident, or leave data behind.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of App E2e Testcases?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/codedroid-team-app-e2e-testcases)
---
name: app-e2e-testcases
description: Turn an app's approved CUJs into test cases an agent can run on the real phone through CodeDroid - preconditions, steps by exact label, an observation rubric (baseline, expected, fail if, inconclusive if), cleanup and its check, with negative cases for each feature's gates and harmful controls - into e2e/TESTCASES.md. Use as step 4 of app-e2e, when asked to write or plan test cases, or when e2e cases are flaky, pass by accident, or leave data behind.
---
# Write the test cases
Cost: first run `npx -y @codedroid/mcp e2e usage start testcases e2e`, and `npx -y @codedroid/mcp e2e usage stop e2e`
when the step ends, before its last `e2e report` (app-e2e, "Cost").
Input: approved `e2e/CUJs.md`, `e2e/EXPLORE.md`. Output: `e2e/TESTCASES.md`. The app-e2e-run skill
runs them with CodeDroid's tools.
## A case
```markdown
### TC-12 · P1 · Save a skill: it appears under "My skills"
Feature: F3 · Type: happy
Covers: R7 (C14)
Tier: core · Depth: screen
Run mode: phone
Changes: data
Preconditions: "My skills" is open; searching "e2e-timer" finds nothing.
Baseline: searching "e2e-timer" in "My skills" shows no result.
Steps:
1. Tap "New skill", name it "e2e-timer", tap "Save".
Expected: "e2e-timer" is listed under "My skills".
Fail if: no "e2e-timer" row, or two of them.
Inconclusive if: "e2e-timer" was already listed before "Save", or "My skills" did not load.
Cleanup: delete e2e-timer.
Cleanup check: searching "e2e-timer" in "My skills" shows no result.
### TC-12a · P0 · Use a skill with a blank: the prompt lands in the composer, not sent
Feature: F3 · Type: happy
Covers: R8 (C17, C18), R8.f1 (C18)
Tier: core · Depth: elsewhere
Run mode: phone
Changes: view
Needs: TC-12 (makes e2e-timer)
Preconditions:
- Chat, a new empty session: the composer is empty.
- "e2e-timer" is in "My skills".
Steps:
1. Tap the Skills tab (`content_description` "Skills"), then "My skills".
2. Tap "Search my skills", type "e2e-tim", tap "e2e-timer".
3. Check "Use Skill" is disabled; tap "Minutes", type "1"; tap "Use Skill".
Expected:
- The composer shows "Open Clock and set a timer for 1 minutes".
- No "Working" row: nothing was sent.
Fail if: the composer is empty or shows "{minutes}", or a "Working" row appears.
Inconclusive if: "e2e-timer" was not in "My skills", or the composer was not empty at the start.
Cleanup: clear the composer.
### TC-00 · P1 · Remove every e2e-... skill an earlier run left
Feature: all · Type: setup
Run mode: phone
Steps:
1. Open "My skills", search "e2e-", delete each result.
## Gaps
- Gap: R7.f2 · a server error cannot be staged from the phone
- Gap: F3 deep · one screen, no long sequence to extend
- Gap: R7 depth · the account cannot reopen the app signed in
```
- Number by CUJ (TC-12a for CUJ-12); the number is compared as a number, so TC-01a is for CUJ-1
and zero-padded ids are fine. `Run mode:` is `phone`, `task` when the case makes CodeDroid's
own agent run something, or `manual` (the PRD's scale), and nothing else: a manual case's reason
goes on its own line, `Why manual: <reason>`.
- `Covers:` the requirement and failure ids it checks, each with the capabilities its Steps tap
or its Expected lines check, in brackets, taken from that requirement's `Caps:`. An entry with no
brackets counts every control in that `Caps:`. Keep `Covers:` on one line: a wrapped line is
not read.
- `Tier:` the kind of scenario. `smoke`: the screen or control is there and opens. `core`: the
main action on the plain path. `deep`: an extended scenario of the main action: several items,
large or awkward data, a long sequence of steps, or state carried across leaving and reopening
the app. `edge`: failure, recovery, interruption (app killed, backgrounded), limits.
- `Depth:` the deepest place its Expected lines check, in the same words as a requirement's
`Proof:`: `screen` (visible where the user acted), `elsewhere` (visible on another screen, a
notification, a file or the server), `kept` (still true after leaving and reopening the app). Tier
and Depth are independent: a core case can check `kept`, a deep case only `screen`. A requirement
whose cases all look shallower than its Proof has no case deep enough: a `kept` one needs a case
that reopens the app (`adb` `shell am force-stop <package>` of the app under test, `open_app`) and
checks again.
- Every Fails line of a P0 or P1 requirement is in some case's `Covers:`, usually an `edge` case
(cancel, bad input, reach the limit), or has a Gap line.
- A case that needs the phone offline is never `phone` or `task`: turning the phone's network off
cuts CodeDroid's link, so nothing could check it. Write it as a `manual` case with
`Why manual: the phone must be offline`, and give the failure a `- Gap:` line too, since a manual
case settles nothing; or write the Gap line alone.
- Every P0 feature has at least one `deep` case, or a `Gap: F<n> deep` line.
- A gap is a line `- Gap: <ref> · <reason>` under a `## Gaps` heading at the end of the file.
`<ref>` is a requirement id (`R4`), a failure id (`R1.f2`), or a feature id and the word deep
(`F1 deep`: that feature has no deep case, on purpose) or a requirement id and the word depth
(`R7 depth`: it has a case, but none checks as deep as its Proof). A ref a runnable case covers
needs no Gap line, and the command reports one that has both, and a depth Gap line for a
requirement that has no case or is already deep enough. A manual case is not a runnable case, and
does not count as a deep case. A Gap line never counts as covered: the quality page lists it under
"Acknowledged gaps". "Left open" lists requirements with no runnable case, requirements whose
deepest case is shallower than their Proof, failure lines of P0 and P1 features with no runnable
case, and P0 features with no deep case, each with no Gap line; it is what is left to write. A
requirement listed as too shallow is fixed by a case whose Expected lines check at its Proof
depth; give it a `depth` Gap line only when this phone or account cannot do that.
- `Feature:` is the PRD feature of its CUJ. `Type:` is `happy` (the journey works), `negative`
(the app refuses or protects, and says so) or `setup` (a case that only prepares or cleans up,
with `Feature: all`). A setup case proves nothing: it needs only its `Run mode:` line, and
`Covers:`, `Tier:` and `Depth:` are left out.
- Every Gate and Harm line in the PRD gets a negative case: the gate blocks with its words; the
harmful control asks before acting, and Cancel leaves the test's own item there. Never confirm
harm on data the cases did not make. A control that acts at once (no confirm, no undo) has
nothing to cancel: give the failure line it belongs to a Gap line, and ask the user whether it
should ask first.
- A harmful control that acts on everything at once (clear all, delete played, remove all) puts
the user's data one mis-tap away. Its case reads the list first and, if anything there is not the
test's own, stops as not run (environment). Tap the dialog's cancel by its label, never by
position.
- A Gate or Harm line with no case: the requirement or failure line it belongs to gets a Gap line
that says why (needs a drag, a second account); a capability the run will not test is a PRD
Non-goal line instead. A requirement that already has a case cannot also take a Gap line (the
command reports a ref that has both): the blocked or confirmed behavior is a failure of that
requirement, so add a failure line `R<n>.f<m>` for it in `PRD.md`, with its exact words, then
give that failure a case or a `- Gap:` line.
- Expected lines are outcomes on the screen or in the app, exact words in quotes. Not how it got
there, and nothing that changes with the screen or the clock.
## Preconditions, the observation rubric and cleanup
Every case but a setup case has these lines; `e2e report` lists a missing one as a problem. Any of
them may wrap onto the next lines; only `Covers:` must stay on one line.
- `Preconditions:` what must be true before step 1: the screen it starts on, the account, the items
it needs. On the line, or as a list right under an empty `Preconditions:` line. When the top of
the file describes a start state every case shares, name it and add only what this case needs
("the start state above; no folder "e2e-tc-dup""). `Start:` is its old name and is still read; a
case has one or the other. `Needs:` stays its own line.
- `Changes:` the most lasting thing the case changes, across its steps and cleanup: `none` (it only
reads), `view` (a screen, a search, a sheet: nothing is saved), `data` (it saves, deletes or
changes a setting, even if its cleanup undoes it), or `unsure`. A `data` or `unsure` case has a
`Cleanup:` and a `Cleanup check:` line; a `none` case has no `Cleanup:`.
- `Baseline:` what to read before step 1 that the Expected lines are compared with: the list
without the item, the setting's value. Write it under `Preconditions:`, before `Steps:`. Give one
whenever an Expected line is a count, a value or a list that only means something against what
was there before; leave it out only when the claim needs no before and after, and leaving it out
cannot let a broken app pass.
- `Expected:` the pass condition, as above.
- `Fail if:` a reading that contradicts Expected while the case itself ran as written: the wrong
item, two of them, the old value, an empty result. Not "the screen did not load".
- `Inconclusive if:` when the run cannot judge the claim: a precondition was not met, the baseline
could not be read or already showed the result, the case reached the wrong item or screen. The
run reports it as not run (environment), never as fail. Draw the line by what the case tests: a
step that only prepares (makes the first folder so a second one can clash) and could not be done
is inconclusive; the app failing at the action the case is about is a `Fail if:` reading.
- `Cleanup check:` what shows the cleanup worked: the item is gone, the value is back. It checks
the reset, not the feature.
## Widen: variations and failure paths
A first draft tests each journey once, on the plain path. Before the report, go through it again,
feature by feature, with the feature's source open:
- **Variations.** For each happy case, list what the user can vary that the code treats
differently: the kind of item (file or folder, picture, empty, large, a name with spaces, accents
or a leading dot), how many (one, several, all), where the action starts (row menu, details,
preview, multi-select, toolbar), where it goes (root, subfolder, the same place), and each
setting value that changes the action. Every branch the source takes on one of these gets its own
case, or its own step with its own Expected line. Variations that run the same code are one case.
- **Failure paths.** For each action, find every message its code can show: the error, toast,
snackbar and dialog strings its classes use, and the validation it runs (empty, too long,
forbidden characters, a name already used, the same place, a size or count limit). Add each one
to the PRD as a failure line with its exact words, then give it a negative or edge case that
stages it and expects those words, or a Gap line that says why the phone cannot stage it.
Also: cancel half-way, leave and come back mid-action, and retry after a failure.
- **Settings.** Each setting gets a case per value that changes behaviour: it checks the
behaviour, not only the switch, and that it is kept after reopening the app.
Most requirements whose source has an error branch end with at least one negative or edge case.
## Rules that came from cases failing for the wrong reason
| Do | Because |
| --- | --- |
| Select by the exact label from `EXPLORE.md`; by `content_description` for icons | Guessed labels fail as not_found |
| Read disabled/checked from the clickable parent line | The flag is not on the label's own line |
| Skip a tap on a tab that is already selected; hide the keyboard before tapping a tab | A selected tab is not clickable; the keyboard covers the tab bar |
| Find list items by searching a prefix, then tap the full name | Long lists hide rows; the search box holds the full name too, so the tap is ambiguous |
| Tap a row's menu by the row it belongs to, never "the first More" | Shared phones have rows the test did not make |
| `wait_for` content that loads after a screen opens | A tap right away misses it |
| `wait_for` text no other state shows ("In the inbox" is inside "No episodes in the inbox") | It matches substrings, so it passes on the empty state |
| Wait for the end state ("Delete"), not `gone_text` of the busy one ("Cancel download") | `gone_text` passes before the busy text has appeared |
| Match times loosely ("9:00" then "a.m.") | Android puts a narrow no-break space before "a.m." |
| Ask the agent to put the checked fact first in its reply | `get_screen` cuts text at 120 characters |
| Assert on a result row, not on the text you just typed | The search box shows your own query |
| A first case that removes every `e2e-...` item an interrupted run left | Leftovers make the next run ambiguous |
| Make a case that needs another case's result say so (Needs:) | Run alone, it fails for the wrong reason |
| Pick a result by its title plus a second field (uploader, length) | Search results repeat titles |
| End playback in the cleanup of any case that starts it | A paused player keeps its notification and the next case starts on it |
| Expect upper-case dialog buttons where EXPLORE saw them | The screen can upper-case a source string |
## Rules that keep it safe
- Everything a case creates is named `e2e-...` and removed by the case that ends with it. Data the
app gets from elsewhere (a feed, a catalog) cannot be named: use the items the PRD's Constraints
call the test's own, found by an exact second field (feed title, uploader).
- `task` cases: read-only instructions (the battery level, wait N seconds), or reversible ones.
- Nothing that sends, buys, posts, publishes or deletes data the cases did not make.
- Never force-stop, clear or uninstall com.codedroid.agent.
## Before handing to the user
Run `npx -y @codedroid/mcp e2e report e2e`; it must print no problems before you go on (fix each
`file:line: message` and rerun). Then send the cases through the app-e2e-verify skill, and finish
its loop before the user sees anything.
Only then give the user the pages, as that skill's gate 2 says: `e2e/TESTCASES.html` to review and
`e2e/QUALITY.html` for what no runnable case covers. Add: its "Left open" list should be empty, or
each item explained; the cases by feature, with priority, type and which run a CodeDroid task; the
CUJs without a case and the Gate and Harm lines without a negative case, and why. Ask for approval
before running.