.NET Generate All Tests

This documentation was generated with the assistance of AI. Please report any inaccuracies.

Bring an entire .NET/C# codebase’s unit test coverage up to a minimum bar — 80% line coverage — in one pass: find every class with no test class at all or with measured coverage below the bar, then write or extend tests for each until it clears it. .NET/C# only; it does not run against, or fall back to, any other language.

Purpose

iru-dotnet-generate-all-tests answers "bring this whole codebase’s test coverage up to a bar" rather than "write tests for this one class/task," which is what iru-dotnet-code-one-task and the iru-code pipeline already handle per task. It explores the whole codebase to build an inventory of testable classes, delegates to iru-dotnet-coverage for the exact, measured percentage per class (never an estimate), and only writes or extends test code — it does not add license headers, doc comments, or run a code-quality pass, and it only touches production source code when a class is genuinely untestable as written (e.g. no seam to substitute a hard dependency), which it reports explicitly rather than silently redesigning the class.

With several .sln/.slnx files and no obvious target it asks which to use. For a Windows desktop app repository (a WinExe project with UseWPF/UseWinUI/UseWindowsForms; plan key windows) the skill applies only to the UI-free Core project (src/<App>.Core) and its portable test project (tests/<App>.Core.Tests): classes in the app project (windows, pages, forms, code-behind, converters) are listed as "excluded — UI layer, not measured" in the final report rather than given tests that need a UI thread, logic found there is named as a candidate to move into Core. The coverage pass never writes UI-thread unit tests for them; instead, when the repository already has a UI-test project, Step 7b generates UI tests for the screens and components that have none (see below).

Step 7b follows the catalog’s UI contract (see Building user interfaces): when the repository already has a UI-test project — FlaUI tests/<App>.UITests for a Windows desktop app, or Terminal.Gui view tests for a command-line tool with a ui: tui terminal UI — it inventories every screen and component, finds those with no UI test, and has one sub-agent per screen/component write one. Each test captures every visual state × the .ui-quality.yml directions × themes into .ui-screenshots/ (terminal captures are .txt) and runs the accessibility check (Axe.Windows on the desktop, the asserted tui-* checks in a terminal UI). A repository with no UI-test project is reported "no UI-test project — UI tests not generated"; this skill never scaffolds one.

Purpose group

Plugin

Shipped by the iru-dotnet plugin of the ai-catalog marketplace (install with /plugin install iru-dotnet@ai-catalog; see Plugins).

Invocation

/iru-dotnet-generate-all-tests

Inputs

None — no arguments are accepted. It always scopes to the whole repository’s .NET solution(s)/project(s).

Outputs

  • New or extended test files for every class found with no matching test class, or with line coverage below 80% — following this project’s own existing test framework (xUnit/NUnit/MSTest), mocking library, and naming/folder convention.

  • Occasionally, a minimal testability change to a class under test (e.g. extracting an interface, injecting a dependency) — only when a class is genuinely untestable as written, and always called out explicitly rather than folded silently into "tests added."

  • A report: total candidate classes found (and any excluded as having no testable logic), how many already met the bar, before/after coverage per class touched, any class still below 80% after two extension attempts (with its exact remaining uncovered lines), and the full-suite test result.

  • For a repository with a UI-test project (Step 7b): new UI test classes for every screen and component that lacked one, the .ui-screenshots/ captures they write, and a report of the screens/components inventoried, those newly covered (states covered), the ui run result (or "unverified (needs Windows)"), screenshot counts per kind, malformed names, the .ui-quality.yml accessibility level (none reported as "accessibility: opted out", off as "accessibility checks off") with its violations (count + rule ids), and any view changed only to add an automation id.

  • No license headers, doc comments, or code-quality fixes — those remain iru-check-license, iru-dotnet-docfx, and `iru-dotnet-code-quality’s jobs.

Execution flow

flowchart TD A[Start /iru-dotnet-generate-all-tests] --> B{".sln/.csproj found?"} B -- no --> B1[Stop: .NET/C# only] B -- yes --> C["Explore agent: inventory every\nmain-source class + existing test\nconvention + test project(s)"] C --> C2["Windows desktop app: restrict scope to the Core\nproject; list app-project classes as\nexcluded (UI layer)"] C2 --> D{"Any test project exists?"} D -- no --> D1[Stop: ask user, this skill\nextends tests, doesn't scaffold a project] D -- yes --> E["gate-runner: single dotnet-coverage run\nover every candidate class\n(batched if the list is large)"] E --> F["Classify: missing tests /\nbelow 80% / already sufficient"] F --> G["One agent per class (parallel batches):\nwrite new or extend existing tests"] G --> H["Re-measure via dotnet-coverage,\nscoped to touched classes"] H --> I{"Still below 80%?"} I -- yes, attempts left --> G I -- yes, 2 attempts used --> J[Report as residual gap\nwith exact uncovered lines] I -- no --> K["gate-runner: run full suite\nonce (dotnet-test)"] J --> K K --> L{"Any failures?"} L -- yes, caused by this run --> M[Fix regression; re-run full suite] M --> K L -- no / pre-existing --> L2{"UI-test project exists?"} L2 -- yes --> L3["Step 7b: sub-agent per screen/component\nwithout UI tests; run via dotnet-test ui"] L2 -- no --> N[Final report] L3 --> N

Dependencies

Invokes

  • .NET Coverage — Step 3, and again in Step 6 to re-measure after generation: delegated through the iru-gate-runner agent so its full coverage.cobertura.xml-derived report never lands directly in this conversation, and so the whole suite runs once per batch rather than once per class.

  • .NET Test — Step 7, once, to confirm the full suite still passes after every class’s tests have been written or extended; also delegated through iru-gate-runner. Step 7b runs it again with the ui selector for the newly generated UI tests (Windows-only for desktop apps, otherwise unverified; any host for terminal UI tests).

Invoked by

None — meant to be run directly by a person who wants coverage brought up across the whole codebase in one pass, independent of the /iru-code//iru-issue pipeline (which handles per-task test-writing via iru-dotnet-code-one-task).

  • Explore — Step 2, to build the class/test-file inventory across the whole codebase without reading every source file directly.

  • iru-gate-runner — Steps 3, 6, 7, and 7b, to run iru-dotnet-coverage/iru-dotnet-test and report back only a compact summary instead of a raw coverage/test log.

  • general-purpose (default, no subagent_type named) — Step 5, one per class needing new/extended tests, dispatched concurrently since each only touches its own test file; Step 7b also uses it for one agent per screen/component needing UI tests.

Source

SKILL.md on GitHub — the file this page was generated from.