Mockito alternatives and similar libraries
Based on the "Testing" category.
Alternatively, view Mockito alternatives based on common mentions on social networks and blogs.
-
Apache JMeter
Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services -
TestContainers
Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container. -
MockServer
MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding). -
PowerMock
PowerMock is a Java framework that allows you to unit test code normally regarded as untestable. -
Awaitility
Awaitility is a small Java DSL for synchronizing asynchronous operations -
AssertJ
AssertJ is a library providing easy to use rich typed assertions -
ArchUnit
A Java architecture test library, to specify and assert architecture rules in plain Java -
Pact JVM
JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project. -
JSONAssert
Write JSON unit tests in less code. Great for testing REST interfaces. -
JMockit
Advanced Java library for integration testing, mocking, faking, and code coverage -
Citrus
Framework for automated integration tests with focus on messaging integration -
System Rules
A collection of JUnit rules for testing code which uses java.lang.System. -
junit-dataprovider
A TestNG like dataprovider runner for JUnit with many additional features -
ConcurrentUnit
Toolkit for testing multi-threaded and asynchronous applications -
Mutability Detector
Lightweight analysis tool for detecting mutability in Java classes -
Lamdba Behave
A modern testing and behavioural specification framework for Java 8 -
Jukito
The combined power of JUnit, Guice and Mockito. Plus it sounds like a cool martial art. -
Arquillian
Integration and functional testing platform for Java EE containers. -
Randomized Testing
Randomized Testing (Core JUnit Runner, ANT, Maven) -
Spectrum
A BDD-style test runner for Java 8. Inspired by Jasmine, RSpec, and Cucumber. -
Scott Test Reporter
Never debug a test again: Detailed failure reports and hassle free assertions for Java tests - Power Asserts for Java -
pojo-tester
Java testing framework for testing pojo methods. It tests equals, hashCode, toString, getters, setters, constructors and whatever you report in issues ;) -
raml-tester
Test if a request/response matches a given raml definition
Access the most powerful time series database as a service
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Mockito or a related project?
README
Most popular mocking framework for Java
Current version is 4.x
Still on Mockito 1.x? See what's new in Mockito 2! Mockito 3 does not introduce any breaking API changes, but now requires Java 8 over Java 6 for Mockito 2. Mockito 4 removes deprecated API.
Mockito for enterprise
Available as part of the Tidelift Subscription
The maintainers of org.mockito:mockito-core and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.
Development
Mockito publishes every change as a -SNAPSHOT
version to a public Sonatype repository. Roughly once a month, we
publish a new minor or patch version to Maven Central. For release automation we use Shipkit
library (http://shipkit.org), Gradle Nexus Publish Plugin.
Fully automated releases are awesome, and you should do that for your libraries, too!
See the latest release notes
and latest documentation. Docs in
javadoc.io are available 24h after release. Read also
about semantic versioning in Mockito.
Older 1.x and 2.x releases are available in Central Repository and javadoc.io (documentation).
More information
All you want to know about Mockito is hosted at The Mockito Site which is Open Source and likes pull requests, too.
Want to contribute? Take a look at the Contributing Guide.
Enjoy Mockito!
Need help?
- Search / Ask question on stackoverflow
- Go to the mockito mailing-list (moderated)
- Open a ticket in GitHub issue tracker
How to develop Mockito?
To build locally:
./gradlew build
To develop in IntelliJ IDEA you can use built-in Gradle import wizard in IDEA. Alternatively generate the importable IDEA metadata files using:
./gradlew idea
Then, open the generated *.ipr file in IDEA.
How to release new version?
- Every change on the main development branch is released as -SNAPSHOT version to Sonatype snapshot repo at https://s01.oss.sonatype.org/content/repositories/snapshots/org/mockito/mockito-core.
- In order to release a non-snapshot version to Maven Central push an annotated tag, for example:
git tag -a -m "Release 3.4.5" v3.4.5
git push origin v3.4.5
- At the moment, you may not create releases from GitHub Web UI. Doing so will make the CI build fail because the CI creates the changelog and posts to GitHub releases. We'll support this in the future.
*Note that all licence references and agreements mentioned in the Mockito README section above
are relevant to that project's source code only.