JUnit 5

This tutorial will guide you through the process of running Unit Tests and Integration Tests separately in a Maven-based Spring Boot application. We will use the JUnit Tag feature to group our test cases and separate Unit Tests from Integration Tests. To learn more, check out the Test Java code tutorials page. Create your tests…

Read More Running Unit Tests and Integration Tests Separately in Spring Boot

Welcome, and thank you for choosing this tutorial! If you’re an absolute beginner looking to learn about integration testing for Spring Boot applications with a MySQL database server, then you’re in the right place. As you proceed through this tutorial, remember that everyone was once a beginner, and the only silly question is the one…

Read More Integration Testing with Spring Boot, MySQL and Testcontainers

This tutorial will guide you on how to incorporate JUnit support into your Spring Boot application based on Maven. Spring Boot Starter Test Dependency To add JUnit and Mockito support to your Maven-based Spring Boot application, include the following dependencies in the <dependencies> section of your pom.xml file: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> By adding…

Read More JUnit Support in Spring Boot

In this tutorial, you will learn about JUnit5 Lifecycle methods. A Lifecycle Method is any method that is directly annotated or meta-annotated with @BeforeAll, @AfterAll, @BeforeEach, or @AfterEach. Let’s have a look at these annotations one by one. @BeforeAll When a method is annotated with @BeforeAll it means that the method should be executed before…

Read More A Guide to JUnit5 Lifecycle Methods

In this guide, you will learn to use @RepeatedTest and @ParametrizedTest annotations introduced in JUnit 5. We’ll look at the capability that lets us run a test a certain number of times.  We’ll also look at interfaces that will allow us to retrieve information about the repeated tests.  Moreover, we will also look at a…

Read More A Guide to @RepeatedTest and @ParametrizedTest in JUnit 5