Testing

A More Practical Guide to JUnit 5 Parameterized Tests

Learn how to write JUnit 5 parameterized tests. Learn answers to some of the most asked questions about parameterized tests.

Getting Started with JUnit 5: Writing Your First Test

Learn how to write and run a simple JUnit 5 test. Setup preconditions, interact with the object we want to test, and verify that it behaves like expected.

JUnit 5 Assertions: Verifying Test Results

Learn how to verify test results using JUnit 5 assertions. Learn the basic assertion methods, error message customization and assertion grouping.

JUnit 5 With Kotlin for Java Developers

Learn the differences between writing JUnit 5 tests in Kotlin and Java. Learn to configure JUnit 5 in the build script using Gradle Kotlin DSL.

JUnit 5 Maven Example: Running Tests with Surefire

Learn how to get the required dependencies for writing JUnit 5 tests with Maven. Also, learn how to configure the Maven Surefire plugin to run the tests.

JUnit 5 Gradle Example

Learn how to get the required dependencies for writing JUnit 5 tests with Gradle. Also, learn how to configure the JUnit Gradle plugin to run the tests.

Migrating From JUnit 4 to JUnit 5: A Definitive Guide

Learn how to migrate from JUnit 4 to JUnit 5. See how to run existing tests along with the new version, and what changes are needed to migrate the code.

Testing myth #2: Unit tests are not worth it

There are a lot of developers and managers who think that writing unit tests is just extra work. Suggesting that we should write more unit tests seems to receive ill responses. I think there are many people out there who still don’t understand the purpose of unit testing. This kind of thinking is probably the result of following kind of experiences: Writing unit tests is really hard and time consuming. Even small changes in requirements keep breaking the unit tests. Unit tests are not finding any real bugs. It is not that writing unit tests is somehow fundamentally laborious. These kind of experiences are symptoms of something else.

Testing myth #1: Writing tests slows you down

Let’s assume we have decided to increase the stability of our software. So we decide to write tests for our code. The problem is that the customer is requesting new features and deadlines are approaching.

Using Mockito With JUnit 5

Learn how to use the Mockito mocking framework with JUnit 5. Learn both the test framework independent way, and using the Mockito JUnit 5 extension.