mockito
Mockito is a Rust library for creating and running HTTP mocks locally, designed to simplify integration testing and offline development. It supports both sync and async workflows, parallel test execution, and multiple concurrent mock servers.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | lipanski/mockito |
| Owner | lipanski |
| Primary language | Rust |
| License | MIT — OSI-approved |
| Stars | 777 |
| Forks | 66 |
| Open issues | 7 |
| Latest release | 1.7.2 (2026-02-02) |
| Last updated | 2026-02-23 |
| Source | https://github.com/lipanski/mockito |
What mockito is
Mockito provides a pool-based HTTP mocking server for Rust with HTTP/1 and HTTP/2 support, comprehensive request matchers (regex, JSON, query parameters), spy/assertion capabilities, and both synchronous and asynchronous APIs. It requires Rust 1.85.0+.
Get the mockito source
Clone the repository and explore it locally.
git clone https://github.com/lipanski/mockito.gitcd mockito# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Minimum Rust version is 1.85.0; verify all team members and CI pipelines meet this requirement.
- Use `_async` methods explicitly for async tests; mixing sync/async patterns incorrectly will cause runtime panics.
- Mock assertion failures display colored diffs by default; disable via feature flags if colors are problematic in CI logs.
- Each test requesting a new server from the pool incurs setup overhead; reuse servers when appropriate to speed up test suites.
- Matchers support regex, partial JSON, and query parameters; test matcher logic carefully to avoid false positives/negatives.
When to avoid it — and what to weigh
- Production Traffic Interception — Mockito is designed for test environments only. Do not use in production code paths or for intercepting real traffic to live services.
- Heavy Performance Simulation — While capable, Mockito is optimized for testing, not realistic latency/throughput benchmarking. Use load-testing tools for that purpose.
- Stateful Protocol Mocking — Limited support for complex stateful protocols beyond HTTP. If you need WebSocket or gRPC mocking, evaluate alternatives.
- Non-Rust Codebases — Mockito is a Rust-native library. Cross-language or polyglot teams should consider language-agnostic mocking solutions.
License & commercial use
Licensed under MIT (MIT License), a permissive OSI-approved open-source license allowing commercial use, modification, and distribution with minimal restrictions.
MIT license explicitly permits commercial use in production codebases. No proprietary restrictions on derivatives or commercial software that depend on this library. However, review your organization's compliance requirements and ensure proper attribution per MIT license terms.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
Mockito runs local HTTP servers in test environments and should never touch production traffic. No sensitive data handling noted. If mocks are inadvertently exposed or test code leaks to production, review all mock endpoints for accidentally embedded secrets. Standard Rust memory safety applies; no known security advisories mentioned in provided data.
Alternatives to consider
wiremock-rs
Similar HTTP mocking for Rust with a different API design and community adoption; evaluate if wiremock-rs better fits your matcher/assertion patterns.
httptest
Lightweight alternative focused on simpler HTTP mocking; consider if Mockito's feature set (HTTP/2, colored diffs, multi-server) is overkill for your tests.
mockserver (non-Rust)
Language-agnostic HTTP mocking; relevant if your stack includes non-Rust services or you prefer a separate service for cross-language testing.
Build on mockito with DEV.co software developers
Mockito eliminates external API dependencies in your test suite. Add it to your Cargo.toml, write cleaner tests, and ship faster. Check the docs.rs guide to get started.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
mockito FAQ
Can I use Mockito to mock external APIs during development without running tests?
Does Mockito support parallel test execution?
What happens if a request doesn't match any mock?
Is HTTP/2 fully supported?
Work with a software development agency
DEV.co helps companies turn open-source tools like mockito into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source testing stack.
Ready to Simplify Your Rust HTTP Testing?
Mockito eliminates external API dependencies in your test suite. Add it to your Cargo.toml, write cleaner tests, and ship faster. Check the docs.rs guide to get started.