Proposal: Show request body diff to narrow test output

13 views
Skip to first unread message

Adrian Booth

unread,
Jun 16, 2019, 6:37:25 PM6/16/19
to webmock-users
TLDR: Test output is often times very difficult to decipher as there can be too much noise. I'm here to recommend a custom solution I've written for one of my clients
When I run feature tests that make multiple requests and there's a small difference in the body of the stubbed request and the actual request, it's very difficult to see the diff of the bodies. You usually have to prune through lines and lines of output to discover what the difference was between the two. A solution I propose is to introduce a new helper called check_request_body_diff which takes two parameters; the request_uri and the stubbed request (which is an instance of RequestStub). The matching request is then found through the RequestRegistry and the body diffs are then compared and shown to the user.
This blog post essentially describes the entire problem & solution https://medium.com/@adrianbooth/how-to-significantly-improve-webmock-errors-3add6b5e93d2.
Reply all
Reply to author
Forward
0 new messages