End-to-End Microservice Tests with Cucumber and Spring Boot

E2E Tests with Cucumber

If you work with Microservices, you surely faced the situation in which some of your system processes only make sense after the information flows through several microservices. For instance, if you’re implementing an Event-Driven architecture, you certainly want to verify your Business Processes when events are propagated and other parts react upon them. There are several frameworks you can use for that but, for its simplicity and perfect matching with Business requirements, Cucumber is a great option. Let’s get into the process of writing end-to-end scenarios using Cucumber.

Continue Reading


The Complete Guide to REST (Controller) Tests in Spring Boot: Unit and Integration Tests

Spring Boot Test

There are different ways to test your Controller (Web or API Layer) classes in Spring Boot, some provide support to write pure Unit Tests and some others are more intended to be used for Integration Tests. Within this post, I’ll cover the main three test approaches available for Spring: using MockMVC in standalone mode, MockMVC together with SpringRunner, and using SpringBootTest.

Continue Reading


A practical book about Microservices

Microservices - The Practical Way

Microservices are getting very popular these days. This type of software architecture has a lot of advantages like flexibility and ease at scale. Mapping them into small teams in an organization also gives a lot of efficiency in development.

However, going on the adventure of microservices knowing only the benefits is a wrong call: you need to know what you are facing and be prepared for that in advance. You can get a lot of knowledge from many books and articles on the Internet but, when you get hands-on-code, the story changes.

Continue Reading


How to fix Eureka taking too long to deregister instances

If you use Ribbon and Eureka in your Spring Boot application, you’ll notice that the default configuration is not optimal. Eureka takes too long time to notice that a service went down unexpectedly and in the meantime, your load balancer, Ribbon, will try to connect to the dead one. On the other hand, the official Eureka documentation discourages changing the leaseRenewalIntervalInSeconds parameter so, what can we do here? This post answers that question.

Continue Reading


Sending and receiving JSON messages with Spring Boot AMQP and RabbitMQ

Setting up a Spring Boot application using AMQP with RabbitMQ is not really difficult, and there are many guides on the Internet showing you the basic setup. But creating an application making use of   @RabbitListener  annotations and producing and consuming messages in JSON format is trickier, so I would like to share with you a really simple but more serious approach that those hello-messaging apps.

This article covers:

  • How to send/publish Java Objects as JSON messages using Spring Boot and RabbitMQ   RabbitTemplate.
  • How to read/consume JSON messages to Java Objects using Spring Boot and RabbitMQ   @RabbitListener annotation.
  • How to send and receive Java Objects through RabbitMQ using default Java serializer.

Continue Reading


How to combine Agile with Gamification: write better User Stories

Agile is about being fast and flexible at delivering value, but that doesn’t mean that you shouldn’t care too much about writing User Stories. The description you’ll add to them should not only enable communication and constructive feedback, but also motivate your team.  Within this article I’ll try to expose what are the common pitfalls while writing a User Story, and how game designers have understood this before companies so you can apply gamification techniques to it.

Continue Reading


Test Coverage analysis (with JaCoCo and Sonar) for your Spring Boot app

One of the main metrics for a software project is Test Coverage: if done properly, it gives you a quick picture about how much code is ‘protected’ by tests.

In this article, I’ll show you how to use a minimal configuration for including JaCoCo in our Spring Boot application, and how to process this information with Sonar.

Continue Reading


Agile and Architecture: making it work

There are many articles about this topic: your company/team is working Agile and you notice soon that you miss Architecture… or at least a little bit of software-design-common-sense if you don’t like big words.

I would like to share my view on the problem, and also what I think is a pragmatic solution to deal with this (difficult) Agile & Architecture combination.

Continue Reading