Snapshot testing
Snapshot tests compare a stable representation of current behavior with a reviewed file committed to source control. Use them when a response or structured result contains enough fields that individual assertions would obscure the contract.
Choose a package
| Goal | Install | Notes |
|---|---|---|
| Snapshot values, JSON, text, controller responses, or complete TestServer exchanges | XBullet.EasyTesting.Snapshots.Core |
Framework-independent built-in engine; no dependency on the outbound HTTP stub package |
Snapshot requests or exchanges recorded by StubHttpMessageHandler |
XBullet.EasyTesting.Snapshots.Http |
Adds adapters for XBullet.EasyTesting.Http; also references snapshot core |
| Keep an existing reference to the former combined package | XBullet.EasyTesting.Snapshots |
Compatibility facade forwarding core and HTTP types; prefer specific packages for new projects |
| Use the Verify.Xunit v3 approval workflow for controller or TestServer exchange snapshots | XBullet.EasyTesting.Verify.Xunit |
Optional xUnit-specific adapter using Verify's files and configuration |
You do not need to understand the package history to start: install snapshot core unless the test snapshots an outbound HTTP stub or intentionally uses Verify.Xunit.
Follow the workflow
- Create and review a first snapshot.
- Understand file locations, names, variants, and parallel target runs.
- Choose a recipe for JSON, text, controller responses, exchanges, or outbound HTTP.
- Stabilize dynamic and sensitive data.
- Configure project-wide or fixture-local defaults.
- Use the guarded mismatch, acceptance, update, and cleanup workflow.
Existing users can follow the package-split migration guide. Teams deciding between approval engines should read built-in snapshots versus Verify.Xunit.
Core rule
A verified snapshot is reviewed test code. Never accept or bulk-update it merely to make a build green. Inspect the difference, confirm that sensitive data is absent, and understand the behavior change before committing the new verified file.
Browse the snapshot core API reference, HTTP adapter API reference, or Verify.Xunit API reference.