Testing with Spring and Spock 1. Introduction In this short tutorial, we’ll show the benefits of combining the supporting power of Spring Boot‘s testing framework and the expressiveness of the Spock framework whether that be for unit or integration tests. 2. Project Setup Let’s start with a simple web application. It can… Continue Reading spring-spock-testing

REST Assured Authentication 1. Overview In this tutorial, we’ll analyze how we can authenticate with REST Assured to test and validate a secured API properly. The tool provides support for several authentication schemes: Basic Authentication Digest Authentication Form Authentication OAuth 1 and OAuth 2 And we’ll see examples for each… Continue Reading rest-assured-authentication

Testing with JGoTesting 1. Overview JGoTesting is a JUnit-compatible testing framework inspired by Go’s testing package. In this article, we’ll explore the key features of the JGoTesting framework and implement examples to showcase its capabilities. 2. Maven Dependency First, let’s add the jgotesting dependency to our pom.xml: <dependency> <groupId>org.jgotesting</groupId> <artifactId>jgotesting</artifactId>… Continue Reading jgotesting

Cucumber and Scenario Outline 1. Introduction Cucumber is a BDD (Behavioral Driven Development) testing framework. Using the framework to write repetitive scenarios with different permutations of inputs/outputs can be quite time-consuming, difficult to maintain and of course frustrating. Cucumber came with a solution for reducing this effort by using the… Continue Reading cucumber-scenario-outline

Testing Reactive Streams Using StepVerifier and TestPublisher 1. Overview In this tutorial, we’ll take a close look at testing reactive streams with StepVerifier and TestPublisher. We’ll base our investigation on a Spring Reactor application containing a chain of reactor operations. 2. Maven Dependencies Spring Reactor comes with several classes for testing… Continue Reading reactive-streams-step-verifier-test-publisher

Guide to JSpec 1. Overview Test runner frameworks like JUnit and TestNG provide some basic assertion methods (assertTrue, assertNotNull, etc.). Then there are assertion frameworks like Hamcrest, AssertJ, and Truth, which provide fluent and rich assertion methods with names that usually begin with “assertThat”. JSpec is another framework that allows… Continue Reading jspec