Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

66%
+2 −0
Q&A What are the drawbacks of using data snapshot testing?

Our team is finally focusing on writing more automatic testing and one of my ex-colleagues recommended to try out the Verify library. The tool does the following: runs the test and compares the...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Derek Elkins‭

#1: Initial revision by user avatar Alexei‭ · 2022-02-08T16:35:27Z (over 2 years ago)
What are the drawbacks of using data snapshot testing?
Our team is finally focusing on writing more automatic testing and one of my ex-colleagues recommended to try out the [Verify library](https://github.com/VerifyTests/Verify).

The tool does the following:

- runs the test and compares the JSON serialization of the actual result with a JSON file named after the test name. The first run will always fail, as the file is missing
- the actual data is written to a file (matching the test name) and the file will become the expected result
- subsequent test runs will succeed as long as the actual result does not change

This is particularly useful for complex objects assertions since it spares the developer to write lots of assertions.

Until now I have avoided comparing large objects, except for rather technical scenarios like deep-cloning where I relied on [Fluent Assertions Object Graphs operations](https://fluentassertions.com/objectgraphs/) (e.g. `Should().BeEquivalentTo`).

The gain is clear and I think it is a great library. I am wondering about its downsides. The only downside I can think of is increasing the effort to quickly understand what's wrong with a failed test since the result is just a partial object graph mismatch instead of an assertion and a human-readable assertion "because" text.