junit5 VS NUnit

Compare junit5 vs NUnit and see what are their differences.

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
junit5 NUnit
13 26
6,166 2,460
1.2% 2.8%
9.7 9.1
1 day ago 5 days ago
Java C#
GNU General Public License v3.0 or later MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

junit5

Posts with mentions or reviews of junit5. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-09-04.
  • Refactoring Multi-Module Kotlin Project With Konsist
    5 projects | dev.to | 4 Sep 2023
    To make the above check work we need to wrap it in JUnit test:
  • CI/CD Pipeline Using GitHub Actions: Automate Software Delivery
    8 projects | dev.to | 21 Jul 2023
    Java / JUnit
  • TDD vs BDD - A Detailed Guide
    6 projects | dev.to | 9 Jun 2023
    Next, you need to install a testing framework that will be used for performing unit testing in your project. Several testing frameworks are available depending on the programming language used to create an application. For example, JUnit is commonly used for Java apps, pytest for Python apps, NUnit for .NET apps, Jest for JavaScript apps, and so on. We’ll use the Jest framework for this tutorial since we are using JavaScript.
  • Spring Cloud Gateway 4.0.0-RC2 native example with Testcontainers
    7 projects | dev.to | 8 Dec 2022
    This repository provides a BuildImageTest that uses the buildpack to create a native image. It then tests the native image, using Testcontainers and JUnit. Building the native image with AOT processing, as part of a test, takes minutes not seconds, and should not be part of normal "inner loop" development. So the BuildImageTest is in a separate sourceSet and can be executed independently. This is a very powerful pattern, that I'm just getting started with. I would love to hear your thoughts on this pattern or other alternatives to it.
  • Building Better Apps with Automated Tests
    2 projects | dev.to | 5 Dec 2022
    To get started with testing, search for a popular testing framework for your programming language. PHP has PHPUnit, for example. Java has JUnit. Flutter apps use Flutter Driver. No matter your language or framework, there is a testing framework that will work for your app.
  • Functions upset
    1 project | /r/javahelp | 1 Dec 2022
    Another library which may be of use to you once you've gotten to grips with the basics of Java is JUnit. JUnit provides functionality for unit testing, allowing you to more easily see if your code is working as expected/if you've accidentally broken anything, via letting you write tests that can check if your code is behaving as expected or not.
  • In One Minute : JUnit
    1 project | dev.to | 5 Oct 2022
    Official Website : https://junit.org/
  • When Should You Use JUnit BeforeEach?
    1 project | /r/Kotlin | 13 Sep 2022
    In my last episode (https://youtu.be/cs2Wu9Co-2s) I said that we shouldn't use JUnit @BeforeEach to setUp test fields. Christoph Sturm (https://twitter.com/globalo) pointed out that there is an, erm, feature of JUnit 5 that means that we sometimes have to use @BeforeEach methods to initialise resources if we want them to be released in @AfterEach. The bug report is here https://github.com/junit-team/junit5/issues/1358 With or without this feature, we probably should use @BeforeEach to run code that will allocate non-memory resources that we need to free in @AfterEach, if only for symmetry. I suppose that also applies to any side-effects that we need to be reverted and that are not confined to the state of the test fixture.
  • Why does Rusts testing tools seem so much less polished compared to its other tooling?
    3 projects | /r/rust | 12 Aug 2022
    Testing tools on the JVM stopped using reflection about twenty years ago, they all use annotations these days (e.g. https://testng.org, https://junit.org). Rust has annotations too, obviously.
  • Integration Testing Done Right
    3 projects | dev.to | 2 Feb 2022
    Testcontainers is a Java library that supports JUnit tests providing lightweight instances of anything that we can run in a Docker container.

NUnit

Posts with mentions or reviews of NUnit. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-07-21.
  • CI/CD Pipeline Using GitHub Actions: Automate Software Delivery
    8 projects | dev.to | 21 Jul 2023
    .NET / xUnit / NUnit / MSTest
  • Fluent Assertions: Fluently Assert the Result of .NET Tests
    3 projects | dev.to | 11 Jul 2023
    This library extends the traditional assertions provided by frameworks like MSTest, NUnit, or XUnit by offering a more extensive set of extension methods. Fluent Assertions supports a wide range of types like collections, strings, and objects and even allows for more advanced assertions like throwing exceptions.
  • TDD vs BDD - A Detailed Guide
    6 projects | dev.to | 9 Jun 2023
    Next, you need to install a testing framework that will be used for performing unit testing in your project. Several testing frameworks are available depending on the programming language used to create an application. For example, JUnit is commonly used for Java apps, pytest for Python apps, NUnit for .NET apps, Jest for JavaScript apps, and so on. We’ll use the Jest framework for this tutorial since we are using JavaScript.
  • Setting up a simple testing project with C#
    7 projects | dev.to | 27 May 2023
    At this point you're going to see a familiar screen asking you to select a project. Here we're looking for a test project. By default, Visual Studio gives you access to 3 different testing frameworks based on your choice of project. These are MSTest, XUnit and NUnit. Ultimately, all 3 of these testing accomplish the same thing, and I've worked with all of them at various points in my career. The difference is mainly in exact syntax and documentation. Although, it's generally considered that MSTest is a little "older" than NUnit or XUnit, so I tend to see it less now. For the purposes of this demo, I'm going to go with NUnit:
  • Test-Driven Development
    3 projects | dev.to | 4 May 2023
    Use a testing framework: Utilize a testing framework like NUnit, xUnit, or MSTest to create, organize, and run your tests. These frameworks provide a consistent way to write tests, generate test reports, and integrate with continuous integration tools.
  • Debugging extension for test library
    2 projects | /r/csharp | 13 Apr 2023
    So I wrote extension attribute for Nunit, the opposite of how the retry attribute works.
  • 2023 Development Tool Map
    20 projects | dev.to | 19 Feb 2023
  • Unlock the Power of Unit Testing: A Beginner’s Guide to Quality Software Development
    3 projects | dev.to | 30 Jan 2023
    This is a basic example of how to create an NUnit unit test for a simple API in a controller with C#. You can find more information and resources on the NUnit website and in the NUnit documentation.
  • Commemorating Charlie Poole's Contributions to the NUnit Project
    1 project | /r/dotnet | 28 Jan 2023
    Has #NUnit helped you, your career, or your organization? We'd love for you to tell that story here, to celebrate Charlie: https://github.com/nunit/nunit/discussions/4283
    1 project | news.ycombinator.com | 28 Jan 2023
    After over TWENTY years leading the NUnit project, Charlie is stepping back.

    Has NUnit helped you, your career, or your organization? We'd love to hear about it at https://github.com/nunit/nunit/discussions/4283.

    > To attempt to quantify Charlie’s contributions to NUnit is a daunting task. He was the lead of NUnit across at least 207 releases in 37 different repositories, authoring 4,898 commits across them. He participated in 2,990 issues, 1,305 PRs, and impacted 6,992,983 lines of code. And those are only the ones we can easily find; our numbers are sourced from after NUnit moved the project to GitHub in 2011, which means there are at least 9 additional years of work not quantified above.

    I think of Charlie as one of the ".NET OSS OGs". I'd love to see him celebrated.

What are some alternatives?

When comparing junit5 and NUnit you can also consider the following projects:

AssertJ - AssertJ is a library providing easy to use rich typed assertions

Fluent Assertions - A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit tests. Targets .NET Framework 4.7, as well as .NET Core 2.1, .NET Core 3.0, .NET 6, .NET Standard 2.0 and 2.1. Supports the unit test frameworks MSTest2, NUnit3, XUnit2, MSpec, and NSpec3.

scalatest-junit-runner - JUnit 5 runner for Scalatest

NSubstitute - A friendly substitute for .NET mocking libraries.

equalsverifier - EqualsVerifier can be used in Java unit tests to verify whether the contract for the equals and hashCode methods is met.

xUnit - xUnit.net is a free, open source, community-focused unit testing tool for .NET.

castlemock - Castle Mock is a web application that provides the functionality to mock out RESTful APIs and SOAP web services.

Moq - Repo for managing Moq 4.x [Moved to: https://github.com/moq/moq]

Minestom - 1.20.4 Lightweight Minecraft server

Shouldly - Should testing for .NET—the way assertions should be!

jext - Simple extension framework for Java applications

coverlet - Cross platform code coverage for .NET [Moved to: https://github.com/coverlet-coverage/coverlet]