LukeMathWalker / wiremock-rs

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

Comparison against httpmock? #64

Closed EvanCarroll closed 3 years ago

EvanCarroll commented 3 years ago

I'm curious to know why you host a comparison that shows no reason to use wiremock over the "prior art" httpmock? Is that the opinion of the developers? And if so, would it not be better to advise in big bold letters at the top of the project that it's deprecated or to officially endorse httpmock?

Sorry this ecosystem is confusing. I'm new. What what you advise me to learn to accomplish this task on a greenfield project?


You can see the comparison outside of the docs in this blog entry,

According to the comparison matrix the most complete package is currently provided by httpmock. For this reason, we will use this one for the rest of this article (and also because I am the developer 😜).

EvanCarroll commented 3 years ago

I'm just curious to know if this also applies for wiremock. From the docs of httpmock,

Attention: This library manages a pool of MockServer instances in the background. Instead of always starting a new mock server, a MockServer instance is only created on demand if there is no free MockServer instance in the pool and the pool has not reached a maximum size yet. Otherwise, THIS METHOD WILL BLOCK the executing function until a free mock server is available.

LukeMathWalker commented 3 years ago

It is true that the two crates have the same features (wiremock-rs's can be used in standalone mode via stubrs).

At the same time, wiremock-rs and httpmock have different APIs: it's a matter of taste what you prefer to use.

As you might imagine, I find wiremock-rs's more intuitive and I prefer it. Otherwise I'd have deprecated the whole thing a long while ago :)

When it comes to pooling, check https://docs.rs/wiremock/0.5.2/wiremock/index.html#efficiency

If you are looking for an in-depth introduction to wiremock-rs, check https://www.lpalmieri.com/posts/how-to-write-a-rest-client-in-rust-with-reqwest-and-wiremock/

LukeMathWalker commented 3 years ago

I'll close this unless you have more specific questions on wiremock-rs.