Quantcast
Channel: JSON – Blog of Leonid Mamchenkov
Viewing all articles
Browse latest Browse all 31

PHPUnit Snapshot Assertions – a way to test without writing actual test cases

$
0
0

phpunit-snapshot-assertions – is an interesting addition to the PHPUnit assertions which allows testing against previously created snapshots.  This is particularly useful for testing the outputs of API end-points, format conversion functions, and the like.  Instead of testing the actual functionality, these assertions allow to compare the output of the current test run with the known good output of a previously created snapshot.

This works well for generic text, but even better for widely used formats like JSON and XML, where, in case of a failed assertion, a meaningful difference can be provided.

Here is a blog post providing some more details on philosophy and methodology.


Viewing all articles
Browse latest Browse all 31

Trending Articles