snapshot-testing
Skill1.2k starsChanged 4 months agoMITView on GitHub
Use Verify for snapshot testing in .NET. Approve API surfaces, HTTP responses, rendered emails, and serialized outputs. Detect unintended changes through human-reviewed baseline files.
1 other project uses a version of this, 1 of them edited.
Trending
More talk lately.thin dataabout the whole repository
Most recently taken up by
- wshaddix/dotnet-skillsedited, first seen Feb 16, 2026
Who's talking about Aaronontheweb/dotnet-skills
- runkids/skillshare“[Request] - Allow partial tracked repository installs”GitHub · Feb 27, 2026 · 1 reactions
- sudosubin/agents.nix“codex-marketplaces.github.aaronontheweb.dotnet-skills: init at 1.6.0”GitHub · Oct 4, 2026
- sudosubin/agents.nix“claude-code-plugins.github.aaronontheweb.dotnet-skills: init at 1.6.0”GitHub · Oct 4, 2026
- sudosubin/agents.nix“claude-code-marketplaces.github.aaronontheweb.dotnet-skills: init at 1.6.0”GitHub · Oct 4, 2026
- sudosubin/agents.nix“agent-skills.github.aaronontheweb.dotnet-skills: v1.6.0 → refs/tags/v1.6.0”GitHub · Oct 3, 2026
The biggest 5 of 10 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 10
Talked about on GitHub (10 times).
On GitHub · 10
- Feb 27, 2026[Request] - Allow partial tracked repository installs — runkids/skillshare1 reaction · 4 comments
- Oct 4, 2026codex-marketplaces.github.aaronontheweb.dotnet-skills: init at 1.6.0 — sudosubin/agents.nix0 reactions
- Oct 4, 2026claude-code-plugins.github.aaronontheweb.dotnet-skills: init at 1.6.0 — sudosubin/agents.nix0 reactions
- Oct 4, 2026claude-code-marketplaces.github.aaronontheweb.dotnet-skills: init at 1.6.0 — sudosubin/agents.nix0 reactions
- Oct 3, 2026agent-skills.github.aaronontheweb.dotnet-skills: v1.6.0 → refs/tags/v1.6.0 — sudosubin/agents.nix0 reactions
5 more on GitHub
- Sep 25, 2026Extend dotnet-aot-compat with a reflection-removal playbook — dotnet/skills0 reactions · 2 comments
- Sep 24, 2026agent-skills.github.aaronontheweb.dotnet-skills: init at 1.6.0 — sudosubin/agents.nix0 reactions
- Jun 7, 2026/plugin marketplace add dotnet/skills installs the aaronontheweb/dotnet-skills marketplace, not this marketplace — dotnet/skills0 reactions · 4 comments
- Feb 11, 2026Claude Code skills and sub-agents for .NET Developers — dacheng-gao/ai0 reactions
- Feb 6, 2026SS-877: Feat - Setup API Module loader using Dotnet Builder Pattern — bcgov/unified-scheduling0 reactions
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- wshaddix/dotnet-skills★ 7929% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository38 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- akka-net-aspire-configurationSkill
- akka-net-best-practicesSkill
- akka-hosting-actor-patternsSkill
- akka-net-managementSkill
- akka-net-testing-patternsSkill
- aot-trimmingSkill
- aspire-configurationSkill
- aspire-integration-testingSkill
- mailpit-integrationSkill
- aspire-service-defaultsSkill
- crap-analysisSkill
- api-designSkill
- modern-csharp-coding-standardsSkill
- csharp-concurrency-patternsSkill
- csharp-nullable-reference-typesSkill
- type-design-performanceSkill
- database-performanceSkill
- dotnet-devcert-trustSkill
- efcore-patternsSkill
- ilspy-decompileSkill
- dotnet-local-toolsSkill
- marketplace-publishingSkill
- microsoft-extensions-configurationSkill
- dependency-injection-patternsSkill
- mjml-email-templatesSkill
- opentelemetry-net-instrumentationSkill
- package-managementSkill
- playwright-blazor-testingSkill
- playwright-ci-cachingSkill
- dotnet-project-structureSkill
- r3-reactive-extensionsSkill
- serializationSkill
- skills-index-snippetsSkill
- dotnet-slopwatchSkill
- testcontainers-integration-testsSkill
- verify-email-snapshotsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Use snapshot testing when:
- Very specific: line 24
First run: Test generates a .received.
- Very specific: line 26
Subsequent runs: Test compares output against .verified.
- Distinctive: line 27
Changes detected: Test fails, diff tool shows differences for review
- Very specific: line 46
Create a ModuleInitializer.cs in your test project:
- Distinctive: line 114
Use Verify to catch unintended changes in rendered email templates:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
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.MSTestConfigure ModuleInitializer
Create a ModuleInitializer.cs in your test project:
using System.Runtime.CompilerServices;
public static class ModuleInitializer
{
[ModuleInitializer]
public static void Init()
{
// Use source-file-relative paths for verified files
VerifyBase.UseProjectRelativeDirectory("Snapshots");
// Configure diff tool (optional - auto-detected)
// DiffTools.UseOrder(DiffTool.Rider, DiffTool.VisualStudioCode);
}
}Basic Usage
Simple Object Verification
[Fact]
public Task VerifyUserDto()
{
var user = new UserDto(
Id: "user-123",
Name: "John Doe",
Email: "john@example.com",
CreatedAt: new DateTime(2025, 1, 15));
return Verify(user);
}Creates VerifyUserDto.verified.txt:
{
Id: user-123,
Name: John Doe,
Email: john@example.com,
CreatedAt: 2025-01-15T00:00:00
}String/HTML Verification
[Fact]
public async Task VerifyRenderedEmail()
{
var html = await _emailRenderer.RenderAsync("Welcome", new { Name = "John" });
// Use extension parameter for proper file naming
await Verify(html, extension: "html");
}Creates VerifyRenderedEmail.verified.html - viewable in browser.
Email Template Testing
Use Verify to catch unintended changes in rendered email templates:
[Fact]
public async Task UserSignupInvitation_RendersCorrectly()
{
var renderer = _services.GetRequiredService<IMjmlTemplateRenderer>();
var variables = new Dictionary<string, string>
{
{ "OrganizationName", "Acme Corporation" },
{ "InviteeName", "John Doe" },
{ "InviterName", "Jane Admin" },
{ "InvitationLink", "https://example.com/invite/abc123" },
{ "ExpirationDate", "December 31, 2025" }
};
var html = await renderer.RenderTemplateAsync(
"UserInvitations/UserSignupInvitation",
variables);
await Verify(html, extension: "html");
}Benefits for email testing:
- Catches CSS/layout regressions
- Detects broken template variables
- Visual review in diff tool
- Version control tracks email changes
API Surface Approval
Prevent accidental breaking changes to public APIs:
[Fact]
public Task ApprovePublicApi()
{
var assembly = typeof(MyLibrary.PublicClass).Assembly;
var publicApi = assembly.GetExportedTypes()
.OrderBy(t => t.FullName)
.Select(t => new
{
Type = t.FullName,
Members = t.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static)
.Where(m => m.DeclaringType == t)
.OrderBy(m => m.Name)
.Select(m => m.ToString())
});
return Verify(publicApi);
}Or use the dedicated ApiApprover package:
dotnet add package PublicApiGenerator
dotnet add package Verify.Xunit[Fact]
public Task ApproveApi()
{
var api = typeof(MyPublicClass).Assembly.GeneratePublicApi();
return Verify(api);
}Creates .verified.txt with full API surface - any change requires explicit approval.
HTTP Response Testing
[Fact]
public async Task GetUser_ReturnsExpectedResponse()
{
var client = _factory.CreateClient();
var response = await client.GetAsync("/api/users/123");
// Verify status, headers, and body together
await Verify(new
{
StatusCode = response.StatusCode,
Headers = response.Headers
.Where(h => h.Key.StartsWith("X-")) // Custom headers only
.ToDictionary(h => h.Key, h => h.Value.First()),
Body = await response.Content.ReadAsStringAsync()
});
}Scrubbing Dynamic Values
Handle timestamps, GUIDs, and other dynamic content:
[Fact]
public Task VerifyOrder()
{
var order = new Order
{
Id = Guid.NewGuid(), // Different every run
CreatedAt = DateTime.UtcNow, // Different every run
Total = 99.99m
};
return Verify(order)
.ScrubMember("Id") // Replace with placeholder
.ScrubMember("CreatedAt");
}Output:
{
Id: Guid_1,
CreatedAt: DateTime_1,
Total: 99.99
}Global Scrubbing
Configure in ModuleInitializer:
[ModuleInitializer]
public static void Init()
{
VerifierSettings.ScrubMembersWithType<DateTime>();
VerifierSettings.ScrubMembersWithType<DateTimeOffset>();
VerifierSettings.ScrubMembersWithType<Guid>();
// Scrub specific patterns
VerifierSettings.AddScrubber(s =>
Regex.Replace(s, @"token=[a-zA-Z0-9]+", "token=SCRUBBED"));
}File Organization
Recommended Structure
tests/
MyApp.Tests/
Snapshots/ # All verified files
EmailTests/
WelcomeEmail.verified.html
PasswordReset.verified.html
ApiTests/
GetUser.verified.txt
EmailTests.cs
ApiTests.cs
ModuleInitializer.cs.gitignore
# Verify - ignore received files (only commit verified)
*.received.*.gitattributes
# Treat verified files as generated (collapse in PR diffs)
*.verified.txt linguist-generated=true
*.verified.html linguist-generated=true
*.verified.json linguist-generated=trueCI/CD Integration
Fail on Missing Verified Files
[ModuleInitializer]
public static void Init()
{
// In CI, fail instead of launching diff tool
if (Environment.GetEnvironmentVariable("CI") == "true")
{
VerifyDiffPlex.UseDiffPlex(OutputType.Minimal);
DiffRunner.Disabled = true;
}
}GitHub Actions
- name: Run tests
run: dotnet test
env:
CI: true
- name: Upload snapshots on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: snapshots
path: |
**/*.received.*
**/*.verified.*When to Use Snapshot Testing
| Scenario | Use Snapshot Testing? | Why |
| Rendered HTML/emails | Yes | Catches visual regressions |
| API surfaces | Yes | Prevents accidental breaks |
| Serialization output | Yes | Validates wire format |
| Complex object graphs | Yes | Easier than manual assertions |
| Simple value checks | No | Use regular assertions |
| Business logic | No | Use explicit assertions |
| Performance tests | No | Use benchmarks |
Best Practices
DO
// Use descriptive test names - they become file names
[Fact]
public Task UserRegistration_WithValidData_ReturnsConfirmation()
// Scrub dynamic values consistently
VerifierSettings.ScrubMembersWithType<Guid>();
// Use extension parameter for non-text content
await Verify(html, extension: "html");
// Keep verified files in source control
git add *.verified.*DON'T
// Don't verify random/dynamic data without scrubbing
var order = new Order { Id = Guid.NewGuid() }; // Fails every run!
await Verify(order);
// Don't commit .received files
git add *.received.* // Wrong!
// Don't use for simple assertions
await Verify(result.Count); // Just use Assert.Equal(5, result.Count)Integration with MJML Email Testing
See the aspnetcore/transactional-emails skill for the complete pattern:
- MJML templates with
{{variable}}placeholders - Render to HTML with test data
- Snapshot test the rendered output
- Review changes in diff tool before approving
This catches:
- Broken variable substitution
- CSS/layout regressions
- Email client compatibility issues
- Unintended content changes
Resources
- Verify GitHub: https://github.com/VerifyTests/Verify
- Verify.Xunit: https://github.com/VerifyTests/Verify.Xunit
- ApiApprover: https://github.com/JakeGinnivan/ApiApprover
- DiffPlex Integration: https://github.com/VerifyTests/Verify.DiffPlex
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

