All Projects → mockiato → Mockiato

mockiato / Mockiato

Licence: mit
A strict, yet friendly mocking library for Rust 2018

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Mockiato

Pester
Pester is the ubiquitous test and mock framework for PowerShell.
Stars: ✭ 2,620 (+1044.1%)
Mutual labels:  mock, mocking
Sinon Jest Cheatsheet
Some examples on how to achieve the same goal with either of both libraries: sinon and jest. Also some of those goals achievable only by one of these tools.
Stars: ✭ 226 (-1.31%)
Mutual labels:  mock, mocking
Nsubstitute
A friendly substitute for .NET mocking libraries.
Stars: ✭ 1,646 (+618.78%)
Mutual labels:  mock, mocking
Fake Xrm Easy
The testing framework for Dynamics CRM and Dynamics 365 which runs on an In-Memory context and deals with mocks or fakes for you
Stars: ✭ 216 (-5.68%)
Mutual labels:  mock, mocking
Mocktail
A mock library for Dart inspired by mockito
Stars: ✭ 172 (-24.89%)
Mutual labels:  mock, mocking
Really Need
Node require wrapper with options for cache busting, pre- and post-processing
Stars: ✭ 108 (-52.84%)
Mutual labels:  mock, mocking
Duckrails
Development tool to mock API endpoints quickly and easily (docker image available)
Stars: ✭ 1,690 (+637.99%)
Mutual labels:  mock, mocking
Cuckoo
Boilerplate-free mocking framework for Swift!
Stars: ✭ 1,344 (+486.9%)
Mutual labels:  mock, mocking
Python Mocket
a socket mock framework - for all kinds of socket animals, web-clients included
Stars: ✭ 209 (-8.73%)
Mutual labels:  mock, mocking
Mockito
Most popular Mocking framework for unit tests written in Java
Stars: ✭ 12,453 (+5337.99%)
Mutual labels:  mock, mocking
Mockery
Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL).
Stars: ✭ 10,048 (+4287.77%)
Mutual labels:  mock, mocking
Ts Auto Mock
Typescript transformer to unlock automatic mock creation for interfaces and classes
Stars: ✭ 204 (-10.92%)
Mutual labels:  mock, mocking
Prig
Prig is a lightweight framework for test indirections in .NET Framework.
Stars: ✭ 106 (-53.71%)
Mutual labels:  mock, mocking
Parrot
✨ Scenario-based HTTP mocking
Stars: ✭ 109 (-52.4%)
Mutual labels:  mock, mocking
Unit Threaded
Advanced unit test framework for D
Stars: ✭ 100 (-56.33%)
Mutual labels:  mock, mocking
Spy
Clojure/ClojureScript library for stubs, spies and mocks.
Stars: ✭ 131 (-42.79%)
Mutual labels:  mock, mocking
Moka
A Go mocking framework.
Stars: ✭ 53 (-76.86%)
Mutual labels:  mock, mocking
Gock
HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽
Stars: ✭ 1,185 (+417.47%)
Mutual labels:  mock, mocking
Httpretty
Intercept HTTP requests at the Python socket level. Fakes the whole socket module
Stars: ✭ 1,930 (+742.79%)
Mutual labels:  mock, mocking
Mocktopus
Mocking framework for Rust
Stars: ✭ 179 (-21.83%)
Mutual labels:  mock, mocking

Mockiato

Build Status Latest Version Documentation dependency status Changelog

A strict, yet friendly mocking library for Rust 2018

⚠️ Disclaimer for working with stable rust

Mockiato relies on the unstable proc_macro_diagnostics API to print helpful messages and the unstable specialization feature to be able to print expected calls.

Mocks work as expected on stable rust, but diagnostics are very limited.
We recommend re-running failing tests using nighly rust in order to pin-point the issue.

Quickstart

#[cfg(test)]
use mockiato::mockable;

#[cfg_attr(test, mockable)]
trait Greeter {
    fn greet(&self, name: &str) -> String;
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn greet_the_world() {
        let mut greeter = GreeterMock::new();

        greeter
            .expect_greet(|arg| arg.partial_eq("world"))
            .times(1..2)
            .returns(String::from("Hello world"));

        assert_eq!("Hello world", greeter.greet("world"));
    }
}

Trait Bounds

Trait bounds are currently not supported meaning that the supertraits will not be implemented for mocks.

The following traits are always implemented for mocks:

Downcasting

An example of how to use downcasting with mockiato can be found in the downcasting example.

Contributing

Enable debug impls in codegen

cargo test --features mockiato-codegen/debug-impls
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].