Mockito

Most popular Mocking framework for unit tests written in Java
Alternatives To Mockito
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Testify20,61414,68870,4265 days ago42May 30, 2023423mitGo
A toolkit with common assertions and mocks that plays nicely with the standard library
Mockito14,21438,95013,120a day ago343June 18, 2023358mitJava
Most popular Mocking framework for unit tests written in Java
Mockery10,466112,37918,26119 days ago40July 19, 2023106bsd-3-clausePHP
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).
Go Sqlmock5,4251,336a month ago21June 28, 202075otherGo
Sql mock driver for golang to test database interactions
Mockk5,090
17 hours ago252apache-2.0Kotlin
mocking library for Kotlin
Mockery5,031277a day ago134August 04, 202339bsd-3-clauseGo
A mock code autogenerator for Go
Powermock4,0718,0892,2664 months ago38November 01, 2020448apache-2.0Java
PowerMock is a Java framework that allows you to unit test code normally regarded as untestable.
Pester2,9294262 months ago91April 05, 2023155otherPowerShell
Pester is the ubiquitous test and mock framework for PowerShell.
Vcrpy2,47886015614 days ago70July 31, 2023131mitPython
Automatically mock your HTTP interactions to simplify and speed up testing
Nsubstitute2,353
a day ago114otherC#
A friendly substitute for .NET mocking libraries.
Alternatives To Mockito
Select To Compare


Alternative Project Comparisons
Readme
Mockito

Most popular mocking framework for Java

CI Coverage Status MIT License

Release Notes Maven Central Javadoc

Current version is 5.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 5 switches the default mockmaker to mockito-inline, and now requires Java 11. Only one major version is supported at a time, and changes are not backported to older versions.

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?

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?

  1. 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.
  2. 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
  1. 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.
Popular Testing Projects
Popular Mocking Projects
Popular Software Quality Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Java
Testing
Mock
Test Driven Development
Java Library
Test Automation
Mocking
Testing Tools
Mockito
Mocking Framework