The first time I ran Snapper it failed with the following error message:
Snapper.Exceptions.SnapshotDoesNotExistException : A snapshot does not exist.
Apply the [UpdateSnapshots] attribute on the test method or class and then run the test again to create a snapshot.
Stack Trace:
SnapshotAsserter.AssertSnapshot(SnapResult snapResult)
Snapper.MatchSnapshot(Object snapshot, SnapshotId snapshotId)
Snapper.MatchSnapshot(Object snapshot, String childSnapshotName)
Snapper.MatchSnapshot(Object snapshot)
SnapperExtensions.ShouldMatchSnapshot(Object snapshot)
GraphQLTests.Queries_Succeed(String queryName) line 57
--- End of stack trace from previous location where exception was thrown ---
This error makes sense as Snapper expects that a snapshot exists when you run your tests. To fix this, you need to update your tests and add the [UpdateSnapshots] attribute above your test method or class.
When Snapper finds this attribute it will not search for an existing snapshot but create a new one(or replace an existing one). After you have run your tests for the first time you can remove the attribute.
Don’t forget to check in the generated files in the ‘_snapshots’ folder to your source control system: