LukeMathWalker / wiremock-rs

HTTP mocking to test Rust applications.
Apache License 2.0
617 stars 70 forks source link

More helpful failed verifications panic messages #62

Open sjud opened 3 years ago

sjud commented 3 years ago

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:

As opposed to specifying which matcher in particular failed.

longfellowone commented 2 years ago

This would be very useful!

LukeMathWalker commented 2 years ago

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!