Mocking in Rust: Mockall and alternatives

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • mockers

    Mocking library for Rust

  • Mockers was inspired by the Google Mock library for C++. Mockers has an efficient syntax that supports stable Rust; however, you can only use some features in nightly Rust (like generic functions).

  • mock_derive

    A mocking library for Rust-lang

  • Mock Derive is useful in simplifying the mocking process. It lets you set up unit tests even when using another testing system, like cargo test.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • galvanic-mock

    A mocking framework for Rust

  • Galvanic-mock is a behavior-driven mocking library. It is part of the testing libraries that work with galvanic-test and galvanic-assert.

  • pseudo

    A small mocking library for Rust

  • Pseudo is a small mocking library. It provides exactly what you need for mocking, and nothing more. Here are some things you can do with Pseudo:

  • wiremock-rs

    HTTP mocking to test Rust applications.

  • Wiremock provides mocking services for applications that interact with HTTP APIs. With Wiremock, you can create mock HTTP servers for testing.

  • faux

    Struct mocking library for Rust

  • 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.

  • mry

    A simple mocking library for structs, traits, and function.

  • Mry allows you to easily create mock objects for unit testing. You can integrate Mry with any testing framework for Rust. Including the inbuilt testing framework, cargo test.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts