Adventures in .NET

Mastering Dotnet Testing: Using Verify to Minimize Assertions - .NET 192

8 snips
Jul 2, 2024
Simon Cropp, an expert in snapshot testing and the tool Verify, joins the conversation to delve into the intricacies of .NET testing. He discusses how snapshot testing simplifies verification of serialized states and reduces test code significantly. The chat highlights Verify's flexibility for managing ordered and unordered collections, as well as its seamless handling of random data. Listeners can also catch tips on advanced snapshot management and hear about intriguing tech recommendations, including the upcoming Star Wars series, 'The Acolyte.'
Ask episode
AI Snips
Chapters
Transcript
Episode notes
INSIGHT

Snapshot Testing Explained

  • Snapshot testing (or serialization assertion) serializes test data and saves it to disk.
  • Subsequent test runs compare new data to the saved snapshot, simplifying assertions.
ADVICE

Simplify Assertions

  • Replace many assertions by running the verify method on objects under test.
  • This serializes the object and compares it to a saved snapshot.
INSIGHT

Verify's Flexibility

  • Verify works with various data, including objects, properties, and anonymous objects.
  • Some caveats exist for data that is not easily serialized or compared.
Get the Snipd Podcast app to discover more snips from this episode
Get the app