unimock
A versatile and developer-friendly trait mocking library (by audunhalland)
faux
Struct mocking library for Rust (by nrxus)
unimock | faux | |
---|---|---|
1 | 4 | |
72 | 449 | |
- | 1.1% | |
8.2 | 6.5 | |
6 months ago | about 2 months ago | |
Rust | Rust | |
MIT License | MIT License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
unimock
Posts with mentions or reviews of unimock.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-06-27.
-
Entrait v0.3.2
A goal when designing Entrait (and unimock) was to create a completely zero-cost design pattern and testing library for Rust applications, even usable in no_std runtimes. Though I don't do any embedded development myself, I believe that Entrait is now a lot closer to that goal.
faux
Posts with mentions or reviews of faux.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-05-23.
-
Mocking in Rust: Mockall and alternatives
Faux allows you to create mock versions of a struct without complicating your code. Like many mocking libraries, faux is only recommended for testing purposes. Mock objects in production may be unstable and cause production problems.
-
Mocking Crates Experience
I am not a fan of the: "make a trait for every struct so it can be tested" strategy that a lot of mocking libraries or hand rolled mocks do in Rust so I wrote my own library that allows you mock structs directly: https://github.com/nrxus/faux/. Unlike libraries that rely on using traits/dynamic dispatch for mocking this let's your signatures stay as simple as you want them and not incur any runtime cost when doing non-test builds.
-
Mocking trait object without a library
for a quick shill moment: I did write a mocking library that deliberately does not pollute the original object and tries to be as out of the way as possible: https://github.com/nrxus/faux/. It does work by using macros (don't hate me yet!) but these macros will only be executed when building for test thus not polluting the original objects for production code.
-
faux: a struct mocking library - landing v0.1
These are the tests for an example: https://github.com/nrxus/faux/blob/master/tests/asynchronous.rs
What are some alternatives?
When comparing unimock and faux you can also consider the following projects:
entrait - Loosely coupled Rust application design made easy
Weld - Full fake REST API generator written with Rust
mock-it - This library aims to make mocking reliable
mock_derive - A mocking library for Rust-lang