FREEDOM251

Freedom251 › Compare

Side by side

Mockito vs NUnit

Both stand on unit testing frameworks. Which one you can start free with, which one lets you read the code, and what each costs once you pay.

Mockito

Free plan AndroidLinuxSelf-hosted

Pick Mockito for Java unit tests that need stubbing, interaction checks, spies, or injected mocks. Its free MIT-licensed distribution and build-system setup suit development teams. Look elsewhere if your environment cannot use Java 11, or if Android testing cannot meet the Android P requirement.

Visit Mockito

NUnit

Free plan AndroidAPIiPhone+4

NUnit offers a free, MIT-licensed testing framework for several .NET languages, with dependency and repeat controls in version 5. Developers can use its project templates or command-line setup and connect test runs to documented CI workflows.

Visit NUnit

The facts

MockitoNUnit
Free planYesYes
Open sourceNot publishedNot published
Runs onAndroid, Linux, Self-hostedAndroid, API, iPhone, Linux, Mac, Self-hosted, Windows
Lowest paid planFree or on requestFree or on request
Plans published11
MakerNot publishedNot published
Websitesite.mockito.orgnunit.org
On unit testing frameworks#15 of 32#11 of 32

Mockito: what it does well

  • Mocks interfaces and concrete classes
  • Supports ordered and call-count verification
  • Spies run real methods while remaining stub-able
  • Provides @InjectMocks field injection
  • MIT-licensed and free to use

What to know first

  • Mockito 5 requires Java 11
  • Android mockito-android tests require Android P or newer
  • There is no free trial period
  • Commercial support and maintenance are available through a Tidelift subscription

NUnit: what it does well

  • Free under the MIT license for commercial and noncommercial use
  • Supports C#, VB.NET, F#, and C++
  • NUnit 5 supports test and fixture dependencies
  • Repeat can set a pass percentage from 1 to 100
  • Documentation describes CI runs on Azure DevOps and GitHub Actions

What to know first

  • No free trial is listed
  • NUnit 5 builds target net462, net8.0, and net10.0

Alternatives to Mockito Alternatives to NUnit The whole list