Thinking of a workflow for testing REST API clients where you snapshot responses to requests made in tests and use the snapshot for a mocked response later.
Is there anything out there to help with that in @rustlang ?
Some kind of insta+mockito mashup?
-
Show this thread
-
i just heard about https://crates.io/crates/wiremock yesterday, haven't tried it
1 reply 0 retweets 3 likes -
Replying to @steveklabnik @rustlang
Ah yep. Seems to occupy the same space as mockito, but perhaps offers better isolation (which is good). I wonder what it'd take to codegen the mocked responses for a given test.
1 reply 0 retweets 1 like -
Author of wiremock here
Are you looking for something similar to the "playback" functionality in the original Java WireMock?http://wiremock.org/docs/record-playback/ …1 reply 0 retweets 2 likes -
This certainly looks to be in the neighborhood, yes! Specifically the section on snapshotting. To be able to run through a series of requests then "bake" the responses for future runs of the test suite is what I'm after.
1 reply 0 retweets 1 like -
Replying to @theomn @algo_luca and
One concern: it would be very nice if the snapshot data was recorded in such a way that it could be sanitized to remove certain things like API keys or other identifying info if used to match against incoming reqs. The section: "customizing your recordings" seems to cover this.
1 reply 0 retweets 1 like -
The original WireMock is extremely sophisticated, it will take a while to get there. The only crate that offers a standalone mode in the mocking space in Rust is https://docs.rs/httpmock/0.3.5/httpmock/ … but at a glance I can't see anything similar to recording and playback.
1 reply 0 retweets 1 like -
Well, it probably goes without saying but it would be a huge boon to the rust web dev ecosystem to have something like this available. Sophisticated as it may be to implement, having to lug around 3rd party services to run integration tests all the time is no way to live.
1 reply 0 retweets 1 like -
I agree 100% - planning to get to that point with wiremock, it might just take a while
2 replies 0 retweets 2 likes -
Replying to @algo_luca @theomn and
@algo_luca have you considered supporting Java WireMock's JSON stub format so that recordings could be imported? Would also enable stubs generated from Spring Cloud Contract, Pact, and Swagger (via http://mocklab.io ) to be used.2 replies 0 retweets 2 likes
I have yet to start looking into it, but it does sound interesting indeed!
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Writing about stuff to learn how it works, mostly in Rust.
Lead Engineer at