Verify is heavily influenced by ApprovalTests. It is designed to be an alternative to ApprovalTests.
ApprovalTests supports producing a single file from a test.
Verify support producing multiple snapshot files from a single test method. For example a snapshot of a webpage can result in both the png and the html being output files.
ApprovalTests extensibility model is primarily based on wrapping the top level api. This results in a limitation of the types of extensibility that can be achieved.
Verify is designed with extensibility in mind with many APIS to plug into. For example:
This results in a simpler process for creating Custom extensions for Verify
Verify supports verification of any object through the use of Json.net
ApprovalTests uses the stack trace and information from debug symbols. This results in a requirement for test assembly to have symbols enable and not be optimized.
Verify has no dependency on the stack trace and debug symbols. So test assemblies do not nee any custom debug build settings when in Release mode.
The act of verification requires access to the file system and (possibly) the clipboard which both require blocking IO. As such the call to Verify()
is async. This means tests are not throttled by IO.
ApprovalTests is, in the majority, configured via attributes.
Verify is configured using explicit code APIs and conventions.
When a test fails verification the difference between the received and verified files is displayed in a diff tool.
In ApprovalTests this feature is opt-in through attributes.
This is a work-in-progress, to contribute more information submit a Pull Request.
- Choose an approach to snapshot management.
- Remove all
ApprovalTests*
NuGets. - Be aware of the usage notes for specific test frameworks.
- Add a reference to the specific test framework variant of Verify (Verify.Xunit/Verify.NUnit/Verify.Expecto/Verify.MSTest).
- Add the Verify.ApprovalTestsTransition NuGet. This NuGet contains signatures for the commonly used ApprovalTests APIs. These APIs a attributed with
[Obsolete]
that point to the alternative APIs and/or documentation. This NuGet is a work-in-progress, submit a PR is more APIs are required. - Fix all obsoletes.
- Remove the Verify.ApprovalTestsTransition NuGet.
- Delete all
*.approved.*
files. - Run all tests.
- Accept all
*.verified.*
files.