JUnit 5: Using Custom DisplayNames for Tests

JUnit 5 provides a powerful feature called @DisplayName, which allows you to customize the display name of your tests for better readability. In this tutorial, we will explore how to take control of your test names using the JUnit 5 DisplayNameGenerator. This feature enables you to create expressive, informative, and dynamic test names, making your test suite more readable and maintainable.

Read more

JMeter DSL: How to Load Test from your code

Performance testing is crucial in ensuring the reliability and scalability of software systems. However, traditional approaches to performance testing often treat it as a separate phase, leading to delayed feedback and issues surfacing late in development. Continuous Performance Testing aims to address this by integrating performance tests into the development pipeline, providing early insights into … Read more

Getting started with JUnit 5 TestSuite

JUnit 5 provides powerful features for organizing and running tests efficiently. Test Suites, a collection of tests bundled together, allow you to execute multiple test classes or methods in one go. In this article we will show a step-by-step guide to create a JUnit 5 TestSyite with some practical examples. How to declare a JUnit … Read more

Testing JPA with TestContainers

Testcontainers is an open-source Java library that simplifies integration testing by providing lightweight, disposable containers for database systems, message brokers, and other third-party services. In this article we will learn how to combine Testcontainer with a JPA/Hibernate Test case.

Read more

How to fix “No ParameterResolver registered for parameter”

The error message you’re encountering, “No ParameterResolver registered for parameter x” is due to the incorrect usage of annotations in the JUnit 5 test.

In JUnit 5, @ParameterizedTest is used to indicate that the annotated method is a parameterized test. However, it seems like in your code snippet, the @ParameterizedTest annotation is mistakenly combined with @Test, causing confusion in the framework.

Here’s a step-by-step tutorial on how to fix this issue:

Read more

How to Test Private Methods with JUnit

When writing unit tests, the best practice is to test public methods, as they are the entry points to your classes and provide the intended behavior to external consumers. Testing private methods, on the other hand, is often considered an implementation detail and not directly exposed to the external API. In this article, we will discuss why testing private methods is not generally a good option and explore an approach to test them using JUnit 5.

Read more

Getting Started with Testcontainers for Java

Introduction In modern software development, it is crucial to write robust and reliable tests to ensure the quality of your applications. One essential aspect of testing is dealing with dependencies, such as databases or external services. Testcontainers is an excellent Java library that provides lightweight, disposable containers for running dependencies during tests. In this tutorial, … Read more