agentleFS
tarunyadav1tarunyadav1/ios-app-lifecycle/skills/ios-testing/SKILL.md

ios-testing

Skill1 starsChanged 36 days agoMITView on GitHub

Write, run and fix tests for iOS apps — Swift Testing and XCTest unit tests, UI tests, snapshot tests, test plans and CI test runs. Use when the user asks to "add tests", "why is this test failing", "set up UI tests", "improve coverage", or before a release.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep views thin. Put decisions in @Observable models and test those.

    line 21
  2. Very specific:

    Use launch arguments (e.g.

    line 23
  3. Distinctive:

    Don't weaken an assertion just to make a test pass.

    line 30
  4. Distinctive:

    Run the full suite on the oldest supported iOS version and on the newest one.

    line 34
  5. Very specific:

    Use an .xctestplan when there are several configurations (locales, UI-test vs unit).

    line 38

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

iOS Testing

Choose the right test

NeedUse
Logic, models, view models, parsingSwift Testing (import Testing, @Test, #expect) for new code; keep existing XCTest suites as they are
Async codeasync test functions; confirmation { } for callbacks; avoid sleeps
User flows (onboarding, purchase, settings)XCUITest with accessibility identifiers
Visual regressionsA snapshot library the project already uses (e.g. swift-snapshot-testing); don't add one without asking
Performance budgetsXCTMetric / measure(metrics:) in XCTest

Write testable code first

  • Inject dependencies (network client, clock, persistence) through initializers or environment values so tests can pass fakes.
  • Keep views thin. Put decisions in @Observable models and test those.
  • Give every interactive element in a UI flow a stable .accessibilityIdentifier.
  • Use launch arguments (e.g. -uiTesting, -resetState) to put the app in a known state for UI tests, and stub the network in that mode.

Run tests

  • On the Mac: xcodebuild test -scheme <Scheme> -destination 'platform=iOS Simulator,name=<device>' [-only-testing:<Target>/<Suite>/<test>].
  • In Cowork: use the XcodeBuildMCP test tools.
  • For a failing test, rerun just that test, read the failure and the .xcresult if it's available (xcrun xcresulttool get test-results summary --path <path>), fix the cause, rerun, then rerun the whole suite.
  • Don't weaken an assertion just to make a test pass. If the test itself is wrong, explain why before changing it.

Before a release

Run the full suite on the oldest supported iOS version and on the newest one. Report pass/fail counts and any flaky tests (a test that passes when retried is still a bug — log it).

Test plans and CI

  • Use an .xctestplan when there are several configurations (locales, UI-test vs unit).
  • In CI, add -resultBundlePath and upload the .xcresult as an artifact when something fails.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.