Designs and improves reliable .NET unit, integration, contract, and end-to-end tests for observable behavior, failure paths, and regressions. Use for test creation or quality/flakiness diagnosis; do not use as a substitute for application implementation or full review.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Testing Quality?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/k4ndev-testing-quality)
---
name: testing-quality
description: Designs and improves reliable .NET unit, integration, contract, and end-to-end tests for observable behavior, failure paths, and regressions. Use for test creation or quality/flakiness diagnosis; do not use as a substitute for application implementation or full review.
---
# Testing Quality
## Purpose
Choose the lowest-cost test boundary that proves the behavior and risk the change actually affects.
## Scope
xUnit/NUnit/MSTest patterns, unit/integration/contract tests, fixtures, deterministic time, flakiness, and test diagnostics.
## When to use
- User asks to add tests, improve coverage, diagnose flaky tests, or validate behavior.
- A behavior change requires regression coverage.
## Do not use for
- Implementing the feature itself: use its domain skill.
- Evaluating a patch against all review guidelines: use `dotnet-code-review`.
- Runtime service diagnostic tooling: use `dotnet-diagnostics`.
## Required context
Identify observable contract, test framework/version, existing fixtures, database/provider and external dependencies, clock/randomness, test command, and CI constraints.
## Workflow
1. Name the behavior and failure risk; select unit tests for isolated logic and integration tests for wiring/framework/persistence semantics.
2. Follow the repository's test framework, naming, assertions, fixtures, and existing infrastructure.
3. Cover representative success, invalid input, authorization/boundaries, and relevant failure/cancellation paths.
4. Use integration tests for DI, middleware, auth, serialization, database translation, and provider-specific behavior.
5. Use relational provider/container when relational semantics matter; EF InMemory is not a relational substitute.
6. Control time via injected `TimeProvider` where supported, random seeds, deterministic synchronization gates, and stable fake boundaries.
7. Assert observable results/state, not only mocks; mock external boundaries rather than every collaborator.
8. Run targeted test then related suite; report exact commands and passed/failed/skipped/not-run distinctly.
## Decision rules
- Avoid sleeps, live network dependencies, order-dependent shared mutable fixtures, and broad mocks that encode implementation details.
- Do not weaken existing assertions to make a regression pass.
- Prefer a regression test that fails for the defect and passes for the intended behavior.
## Expected output format
List scenarios and test level, show representative test code, explain fixture/provider requirements, and report exact execution results without implying unrun checks passed.
## Common mistakes
- Testing private implementation details, relying on EF InMemory for SQL behavior, using real time/sleeps, or asserting only a collaborator call when user-visible state matters.
## Edge cases
- Async tests must await the task and assert cancellation/failure semantics.
- Integration fixtures may share expensive containers, but reset state deterministically and avoid cross-test leakage.
- Time-zone/clock behavior should test DST/offset boundaries when relevant.
## Examples
See [testing examples](examples.md) for a deterministic xUnit test and a flaky sleep-based alternative.
## Test scenarios
- Positive: “Add an integration regression test proving unauthenticated requests cannot reach this endpoint.”
- Negative: “Which EF projection is faster?” routes to `performance-review` / `efcore-patterns`.
- Boundary: “Test changed JSON compatibility” selects this skill and `api-contract-review` when compatibility is the concern.
## Related skills
`dotnet-code-review`, `api-contract-review`, `efcore-patterns`, `security-audit`, `async-concurrency`.