Analyze .NET test code to measure how varied and meaningful the assertions are. Produce a metrics report that reveals whether tests verify different facets of correctness — not just "output equals X" but also structure, exceptions, state transitions, side effects, and invariants.
Low assertion diversity signals shallow testing. Tests may pass while bugs hide in unasserted logic. Common symptoms:
Read all test files the user provides. If the user points to a directory or project, scan for all test files — see the
skill for framework-specific markers.
For each test method, identify all assertions and classify them into these categories:
A single assertion can belong to multiple categories (e.g.,
is both Equality and Negative).
-
Summary Dashboard — A quick-reference table of key metrics:
| Metric | Value | Assessment |
|-------------------------------|--------|------------|
| Total tests | 25 | — |
| Average assertions per test | 2.4 | Moderate |
| Assertion type spread | 5/12 | Low |
| Tests with zero assertions | 3 (12%)| Concerning |
| Tests with only trivial asserts | 4 (16%)| Acceptable |
| Tests with negative assertions | 2 (8%) | Below target |
| Single-category tests | 15 (60%)| High |
-
Category Breakdown — For each assertion category, show:
- How many tests use it
- Representative examples from the code
- Whether it's overused or underused relative to the code under test
-
Gap Analysis — Based on the production code (if available), identify:
- Behaviors that are tested but only with equality checks
- Error paths with no exception assertions
- State-changing methods with no state verification
- Collections returned but never checked for contents
-
Recommendations — Prioritized list of improvements:
- Which tests would benefit most from additional assertion types
- Which assertion categories are missing and why they matter
- Concrete examples of assertions that could be added
-
Assertion-free tests — If any exist, list each one with its method name and what it appears to be testing, so the user can decide whether to add assertions or mark them as intentional smoke tests.