paint-brush
A Package for Snapshot Testing in PHPUnitby@sebdedeyne
2,028 reads
2,028 reads

A Package for Snapshot Testing in PHPUnit

by Sebastian De Deyne4mMarch 27th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The gist of snapshot testing is asserting that a set of data hasn’t changed compared to a previous version, which is a <em>snapshot</em> of the data, to prevent regressions. The difference between a classic <code class="markup--code markup--p-code">assertEquals</code> and an <code class="markup--code markup--p-code">assertMatchesSnapshot</code> is that you don't write the expectation yourself when snapshot testing. When a snapshot assertion happens for the first time, it creates a snapshot file with the actual output, and marks the test as incomplete. Every subsequent run will compare the output with the existing snapshot file to check for regressions.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - A Package for Snapshot Testing in PHPUnit
Sebastian De Deyne HackerNoon profile picture
Sebastian De Deyne

Sebastian De Deyne

@sebdedeyne

L O A D I N G
. . . comments & more!

About Author

Sebastian De Deyne HackerNoon profile picture
Sebastian De Deyne@sebdedeyne

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite