Mutation Testing with PITest 1. Overview Software testing refers to the techniques used to assess the functionality of a software application. In this article, we’re going to discuss some of the metrics used in the software testing industry, such as code coverage and mutation testing, with peculiar interest on how… Continue Reading java-mutation-testing-with-pitest

Integration Testing with the Maven Cargo plugin A very common need in the lifecycle of a project is setting up integration testing. Luckily, Maven has built-in support for this exact scenario, with the following phases of the default build lifecycle (from the Maven documentation):[more-134]# pre-integration-test: Perform actions required before integration… Continue Reading integration-testing-with-the-maven-cargo-plugin

Integration Testing in Spring 1. Overview Integration testing plays an important role in the application development cycle by verifying end-to-end behavior of the system. In this article we will see how we can leverage the Spring MVC test framework in order to write and run integration tests that test controllers… Continue Reading integration-testing-in-spring

Self-Contained Testing Using an In-Memory Database 1. Overview In this tutorial, we’re going to create a simple Spring application which relies on an in-memory database for testing. For the standard profile, the application will have a standalone MySQL database configuration, which requires having the MySQL server installed and running, with… Continue Reading spring-jpa-test-in-memory-database

Introduction to MockServer 1. Overview MockServer is a tool for mocking/stubbing external HTTP APIs. 2. Maven Dependencies To make use of MockServer in our application, we need to add two dependencies: <dependency> <groupId>org.mock-server</groupId> <artifactId>mockserver-netty</artifactId> <version>3.10.8</version> </dependency> <dependency> <groupId>org.mock-server</groupId> <artifactId>mockserver-client-java</artifactId> <version>3.10.8</version> </dependency> The latest version of the dependencies is available as… Continue Reading mockserver

Hamcrest Common Core Matchers 1. Overview In this quick tutorial, we’ll explore the CoreMatchers class from the popular Hamcrest framework for writing simple and more expressive test cases. The idea is to make assert statements read like natural language. 2. Hamcrest Setup We can use Hamcrest with Maven by adding the following dependency to our pom.xml file:… Continue Reading hamcrest-core-matchers

Writing Specifications with Kotlin and Spek 1. Introduction Specification Testing frameworks are complementary to Unit Testing frameworks for testing our applications. In this tutorial, we’ll introduce the Spek framework – a Specification Testing framework for Java and Kotlin. 2. What is Specification Testing? Simply put, in Specification Testing, we start… Continue Reading kotlin-spek

WebAppConfiguration in Spring Tests 1. Overview In this article, we’ll explore the @WebAppConfiguration annotation in Spring, why we need it in our integration tests and also how can we configure it so that these tests actually bootstrap a WebApplicationContext. 2. @WebAppConfiguration Simply put, this is a class-level annotation used to… Continue Reading spring-webappconfiguration