# Assertion Quality

Analyze assertion quality, depth, variety, and false confidence in existing tests.

- Repository: https://github.com/managedcode/dotnet-skills (500 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-10-29
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add managedcode/dotnet-skills --skill assertion-quality -g -a claude-code -y`
Codex: `npx skills add managedcode/dotnet-skills --skill assertion-quality -g -a codex -y`
Cursor: `npx skills add managedcode/dotnet-skills --skill assertion-quality -g -a cursor -y`
Gemini CLI: `npx skills add managedcode/dotnet-skills --skill assertion-quality -g -a gemini-cli -y`

## Description

Analyze assertion quality, depth, variety, and false confidence in existing tests. ALWAYS USE when asked about weak, shallow, trivial, always-true, self-referential, assertion-free, presence/truthiness-only, or insufficiently diverse assertions, including MSTest, Jest, pytest, and Go. DO NOT USE for direct fixes: writing-mstest-tests owns supplied MSTest assertions; code-testing owns new cases. Use test-gap-analysis when asked whether tests would catch a production change, and test-anti-patterns for general severity-ranked audits.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Assertion Diversity Analysis

Analyze test code in any supported language 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.

> **Language-specific guidance**: Read the caller-provided or runtime-listed
> `test-analysis-extensions` catalog, then its matching language file
> (`dotnet.md`, `python.md`, `typescript.md`, `go.md`, etc.).
> `test-analysis-extensions` is reference-only; do not invoke it as a skill.
> If the bundle is absent, use the pinned framework and this skill's rules,
> report the missing reference, and do not search installation directories.

## Why Assertion Diversity Matters

Low assertion diversity signals shallow testing. Tests may pass while bugs hide in unasserted logic. Common symptoms:

| Problem | Symptom | Consequence |
|---------|---------|-------------|
| Trivial assertions | Test contains only `Assert.IsNotNull(result)` / `assert result is not None` / `expect(x).toBeDefined()` | Test passes but doesn't verify correctness |
| Single-value obsession | Always check one field or return value | Bugs in unasserted logic slip through |
| No negative assertions | Never check what shouldn't happen | Regressions sneak in through false positives |
| No state checks | Don't verify object state changes | Missed side-effects or lifecycle issues |
| No structural checks | Only assert top-level value | Bugs in nested objects go unnoticed |
| Assertion-free tests | Tests that call but don't verify | Code coverage lies; false security |

## When to Use

The rest: https://github.com/managedcode/dotnet-skills/blob/HEAD/catalog/Testing/Official-DotNet-Test/skills/assertion-quality/SKILL.md
