Testing asynchronous operations in Java can be challenging, especially when working with microservices, reactive applications, and event-driven architectures where you need to wait for conditions to become true without using unreliable Thread.sleep() calls. Awaitility is a lightweight Java library that simplifies waiting in your tests, allowing you to write clear, fluent, and robust asynchronous tests. In this updated guide, you will learn how to use Awaitility for testing Java, Spring Boot, Quarkus, and Jakarta EE applications, with practical examples aligned with modern testing practices for cloud-native environments and CI/CD pipelines.
Testing Java
JUnit Testing Best Practices: Verifying No Exceptions in Your Java Code
Introduction When writing tests in Java, it’s important to verify that a method or code block behaves as expected. One of the most common things to check is whether an exception is thrown during the execution of a test. However, sometimes we also want to verify that no exception is thrown. This can be particularly … 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.
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
Getting Started with Cucumber Testing in Java
Cucumber is a popular open-source tool that supports Behavior-Driven Development (BDD) for testing software applications in Java. BDD emphasizes collaboration between developers, testers, and stakeholders by writing test scenarios in a readable, plain English language called Gherkin. This tutorial will guide you through the basics of setting up and writing your first Cucumber test in Java.
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.
TestContainers made simple with JBang
This article discusses how to execute Tests on Container Images using JBang as Java scripting tool and TestContainers + JUnit 5 Jupiter as Test library.
How to run JUnit 5 Tests with JBang
This article covers the integration between JUnit 5, the well-known framework for Java testing, with JBang scripting tool. By the end of it, you will learn how to add a robust testing layer to your Java scripts written with JBang.
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