
Snapshot Testing
This walks you through Verify, the .NET snapshot testing library that's genuinely useful for catching regressions in rendered output. Instead of writing a dozen assertions for complex objects, you approve a baseline file once and the test fails if anything changes. The guide covers the practical stuff: rendering email templates to HTML and diffing them visually, approving your public API surface to prevent accidental breaking changes, scrubbing timestamps and GUIDs so tests aren't flaky, and setting up CI so you're not manually clicking through diff tools in your pipeline. If you're testing anything with non-trivial output like HTTP responses or serialized data, this is worth the setup cost.
- skills.sh installs
- 484
- GitHub stars
- 1.3K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add aaronontheweb/dotnet-skills --skill snapshot-testing --agent claude-codeInstalls into .claude/skills of the current project.
Files
Snapshot Testing with Verify
When to Use This Skill
Use snapshot testing when:
- Verifying rendered output (HTML emails, reports, generated code)
- Approving public API surfaces for breaking change detection
- Testing HTTP response bodies and headers
- Validating serialization output
- Catching unintended changes in complex objects
What is Snapshot Testing?
Snapshot testing captures output and compares it against a human-approved baseline:
- First run: Test generates a
.received.file with actual output - Human review: Developer approves it, creating a
.verified.file - Subsequent runs: Test compares output against
.verified.file - Changes detected: Test fails, diff tool shows differences for review
This catches unintended changes while allowing intentional changes through explicit approval.
Installation
Add Verify Package
dotnet add package Verify.Xunit
# or for other test frameworks:
dotnet add package Verify.NUnit
dotnet add package Verify.MSTest
Configure ModuleInitializer
Create a ModuleInitializer.cs in your test project:
using System.Runtime.CompilerServices;
Sponsors
Details
- Repository
- github.com/aaronontheweb/dotnet-skills
- Categories
- Backend & APIs, Testing & QA, .NET & C#
- First seen
- Jun 3, 2026
More from aaronontheweb/dotnet-skills
All 34- Dotnet Devcert Trust457
- Skills Index Snippets456
- Playwright Ci Caching455
- Akka Net Best Practices451
- Mailpit Integration443
- Verify Email Snapshots436
- Akka Hosting Actor Patterns434
- Akka Net Testing Patterns431
- OpenTelemetry NET Instrumentation431
- Akka Net Management430
- Akka Net Aspire Configuration415
- Marketplace Publishing408
- Modern Csharp Coding Standards2.3K
- Csharp Concurrency Patterns1.6K
- Efcore Patterns1.6K
- Dependency Injection Patterns703
- Database Performance700
- Dotnet Project Structure692
- Api Design690
- Type Design Performance684
- Ilspy Decompile640
- Package Management613
- Microsoft Extensions Configuration609
- Serialization596