Closed tl-alex-butler closed 3 years ago
Sounds good to me - having some form of recording functionality was part of the plan anyway to support a "record & replay"/discovery mode. It could also improve error messages massively (e.g. "XYZ was not verified. Here is the list of requests received by the mock server"). I'll spec it out a bit and then come up with a PR!
Currently, as far as I can see, all verification is done implicitly by matchers.
However, when testing against mock APIs I tend to prefer setting up very simple mock server matcher logic with manually verifying the received requests afterwards.
This approach can be nicer in some cases as:
Proposal
I'd like to add some sort of API to retrieve received requests from a mock server.
Then scenarios could go something like:
Other wiremock-ish libs have this sort of thing, e.g. c# one has
.FindLogEntries(matcher)
. We could make all mock-server automatically record requests, or perhaps make it opt in only.