wiremock-rs icon indicating copy to clipboard operation
wiremock-rs copied to clipboard

More helpful failed verifications panic messages

Open sjud opened this issue 3 years ago • 2 comments

Hello, I think having clearer failed verification messages would make debugging multiple chained .and(matcher) calls easier. For example: Mock::given(header_exists("X-Postmark-Server-Token")) .and(header("Content-Type", "application/json")) .and(path("/email")) .and(method("POST")) .and(SendEmailBodyMatcher) Fails with: thread 'email_client::tests::send_email_sends_the_expected_request' panicked at 'Verifications failed:

  • Mock #0. Expected range of matching incoming requests: == 1 Number of matched incoming requests: 0

As opposed to specifying which matcher in particular failed.

sjud avatar Mar 23 '21 20:03 sjud

This would be very useful!

longfellowone avatar Nov 17 '21 20:11 longfellowone

I agree this would be quite useful, but there are some challenges to the implementation 😅 For the time being, my recommendation would be to always use the named method on your Mocks to make it easier to pinpoint what didn't work as expected!

LukeMathWalker avatar Nov 24 '21 11:11 LukeMathWalker