Skip to content

Latest commit

 

History

History
80 lines (44 loc) · 3.41 KB

compared-to-approvaltests.md

File metadata and controls

80 lines (44 loc) · 3.41 KB

Compared to ApprovalTests

Verify is heavily influenced by ApprovalTests. It is designed to be an alternative to ApprovalTests.

Differences to ApprovalTests

Multiple files

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.

Extensibility

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

Object Serialization

Verify supports verification of any object through the use of Json.net

No stack trace and symbols

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.

Async by default

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.

Not attribute driven

ApprovalTests is, in the majority, configured via attributes.

Verify is configured using explicit code APIs and conventions.

Diff tool on by default

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.

Migrating from ApprovalTests

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.