Skip to content

Instantly share code, notes, and snippets.

@vaclavbohac
Last active October 25, 2017 06:31
Show Gist options
  • Save vaclavbohac/466d3be80ec92288463c0a8d370163eb to your computer and use it in GitHub Desktop.
Save vaclavbohac/466d3be80ec92288463c0a8d370163eb to your computer and use it in GitHub Desktop.
Snapshot testing experience

Pros

  • helps very fast to cover complex test cases
  • saves a lot of typing (generally worth to test generated structures)

Cons

  • renaming of files, functions or describes leads to changes that are hard to verify
    • snapshots with old names are deprecated
    • snapshots with new names are generated
    • you don't have a diff between the two
  • first run of the tests generates snapshot, so it's impossible to do red-green-refactor properly
    • you can fake it out by saving first snapshot empty, but you have to think about it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment