Swift Generate All Tests
| This documentation was generated with the assistance of AI. Please report any inaccuracies. |
Bring an entire Swift codebase’s unit test coverage up to a minimum bar — 80% line coverage — in one pass: find every production type (struct, class, enum, actor) with no test at all or with measured coverage below the bar, then write or extend tests for each until it clears it. Swift Package Manager and Xcode projects only; it never runs against, or falls back to, any other language.
Purpose
iru-swift-generate-all-tests answers "bring this whole Swift codebase’s test coverage up to a bar" rather than
"write tests for this one type/task," which is what iru-swift-code-one-task and the iru-code pipeline already
handle per task. It explores the whole codebase to build an inventory of testable types, delegates to
iru-swift-coverage for the exact, measured percentage per type (never an estimate), and only writes or extends
test code — defaulting to Swift Testing (@Suite, @Test, #expect, #require) for unit tests and falling
back to XCTest only for XCUITest and performance (measure) cases, following the project’s own test framework
and style. For apps it also closes the UI-test gap under the catalog’s UI contract (see Building user interfaces): screens and components with no UI tests get component-capture tests and XCUITests that capture every .ui-quality.yml direction x theme and run an accessibility audit, then one full iru-swift-test ui run rebuilds .ui-screenshots/. It does not add license headers, DocC comments, or run a code-quality pass, and it only touches
production source code when a type is genuinely untestable as written, which it reports explicitly rather than
silently redesigning the type.
When .ui-quality.yml says accessibility: none (opted out entirely) or off (rules apply, checks not run), accessibility checks are not applicable: they are skipped and reported as "accessibility: opted out" (none) or "accessibility checks off" (off) — never "unverified" and never a failure.
Plugin
Shipped by the iru-swift plugin of the ai-catalog marketplace (install with /plugin install iru-swift@ai-catalog; see Plugins).
Inputs
| Argument | Required | Description | Default |
|---|---|---|---|
scope |
No |
A Swift package target or Xcode app target to limit the run to, or a comma-separated list of specific types
within it. Accepted as a bare positional argument or as an |
The project’s primary library/app target |
Outputs
-
New or extended test files for every type found with no matching test file, or with line coverage below 80% — defaulting to Swift Testing, following the project’s own test-file naming/source-root convention, and using XCTest only for
XCUITest/measurecases. -
Occasionally, a minimal testability change to a type under test (e.g. extracting a protocol, injecting a dependency) — only when a type is genuinely untestable as written, and always called out explicitly rather than folded silently into "tests added."
-
A report: total candidate types found (and any excluded as having no testable logic), which test framework(s) were detected/used, how many types already met the bar, before/after coverage per type touched, any type still below 80% after two extension attempts (with its exact remaining uncovered lines), and the full-suite test result.
-
For screens and components that had no UI tests: contract UI tests (component suites using
UIScreenshots.render/capture, XCUITests with--fixturedata and oneperformAccessibilityAudit()test), the sharedUIScreenshots.swifthelper when missing, and a report of screenshot counts per kind, malformed names, accessibility issues at the configured level, screens left uncovered (e.g. no UI-test target) and anything unverified. -
No license headers, DocC comments, or code-quality fixes — those remain
iru-check-license,iru-swift-docc, and `iru-swift-code-quality’s jobs.
Execution flow
Dependencies
Invokes
-
Swift Coverage — Step 3, and again in Step 6 to re-measure after generation: delegated through the
iru-gate-runneragent so a large.profdata/llvm-cov/xccovreport never lands directly in this conversation, and so the whole suite runs once per batch rather than once per type. -
Swift Test — Step 5b (
uirun) and Step 7, once, to confirm the full suite still passes after every type’s tests have been written or extended; also delegated throughiru-gate-runner. Step 5b also runs it with theuiselector (a full UI run that clears and rebuilds.ui-screenshots/).
Invoked by
None from inside this catalog — it is a top-level entry point invoked by a person who wants coverage brought up
across the whole Swift codebase in one pass, independent of the /iru-code//iru-issue pipeline (which handles
per-task test-writing via iru-swift-code-one-task).
Related agents
-
Explore— Step 2, to build the type/test-file inventory across the whole codebase without reading every source file directly. -
iru-gate-runner— Steps 3, 6, and 7, to runiru-swift-coverage/iru-swift-testand report back only a compact summary instead of a raw coverage/test log. -
general-purpose(default, nosubagent_typenamed) — Step 5, one per type needing new/extended tests, dispatched concurrently since each only touches its own test file; Step 5b reuses this for one agent per screen or component needing UI tests.
Source
SKILL.md on GitHub — the file this page was generated from.