Closed tl-marco-ieni closed 3 years ago
I like the idea in principle - how do we print a non-matched Mock
though? I feel this is the real open question.
Something like:
Verification failed: expected number of matching incoming requests: {}, actual: {}
That works when you only have one mock mounted on a server, but often you'll have two or more and it's trickier to determine which of those has failed to match.
I am considering the idea of adding a second String
parameter to .expect
to be displayed when verification fails for that mock. A bit like expect
on Option
.
That works when you only have one mock mounted on a server, but often you'll have two or more and it's trickier to determine which of those has failed to match.
Yes, I know, but it's better than nothing.
I am considering the idea of adding a second
String
parameter to.expect
to be displayed when verification fails for that mock. A bit likeexpect
onOption
.
Sounds good!
Let's go with the second parameter on expect
. Do you want to work on this?
sure!
Problem
Right now when expectations are not satisfied a message similar to this one is showed:
It would be nice to print also expected and actual number of times the server was called. They are compared here:
https://github.com/LukeMathWalker/wiremock-rs/blob/40edf7309e2d3680035a15ecf5d306a219fff99a/src/active_mock.rs#L45-L52
Proposed solution
This method:
https://github.com/LukeMathWalker/wiremock-rs/blob/40edf7309e2d3680035a15ecf5d306a219fff99a/src/mock_set.rs#L48-L50
instead of returning
bool
should return something like:where
Incorrect
contains all theActiveMock
s that are not verified.This vector should be printed in some way here:
https://github.com/LukeMathWalker/wiremock-rs/blob/40edf7309e2d3680035a15ecf5d306a219fff99a/src/mock_server.rs#L253-L261
I would like to work on this. Do you like the proposed solution?