pronouns microservices applications

Author : bablusdnablus
Publish Date : 2021-01-09 20:00:44


pronouns microservices applications

If you want to investigate further some of the concepts presented in this article, I have created a practical implementation of it. It was implemented using Java and some correspondent frameworks. You can find it in my Github: https://github.com/teixeira-fernando/EcommerceApp
Microservices architecture is a common architecture pattern that you can find in applications from different companies around the world. There are still many ways to implement this pattern, including several kinds of technologies and components. One of those implementations possibilities includes some message queues, like for example, Apache Kafka and RabbitMQ, that brings an asynchronous behavior to those microservices. This approach has some pros and cons, but in this article, I will focus more on the quality and testing aspects of this option.
Many testers are used to test synchronous microservices and APIs. They have a good knowledge of what they need to validate, some tools that they can use to assist them and how to automate those tests. On the internet, there are many different tutorials and content with instructions on how to do it. The main challenge comes when there is a message queue in this architecture, where I noticed that many QA professionals have difficulties with these asynchronous microservices, because it is more difficult for them to validate the behaviour of these applications using the same techniques that they are used to.
In the same way that the development of applications must evolve, the test strategies for those applications must evolve too. This approach can be applicable with different programming languages and different frameworks, so, let’s try to focus on the concepts of this test strategy, that is the most important point here. With that in mind, I will present to you an approach that worked quite well in some of my previous experiences and in some personal study projects.
The image below represents a very simple architecture, and what each kind of test is intended to cover in this architecture:

https://santaritasaude.azurewebsites.net/sup/video-Buc-v-Was-liv-cnf-01.html
https://santaritasaude.azurewebsites.net/sup/video-Buc-v-Was-liv-cnf-02.html
https://santaritasaude.azurewebsites.net/sup/video-Buc-v-Was-liv-cnf-03.html
https://santaritasaude.azurewebsites.net/sup/video-Buc-v-Was-liv-cnf-04.html
https://santaritasaude.azurewebsites.net/sup/video-Buc-v-Was-liv-cnf-05.html
https://santaritasaude.azurewebsites.net/sup/video-Nikkan-v-Enj-fuji-tv-01.html
https://santaritasaude.azurewebsites.net/sup/video-Nikkan-v-Enj-fuji-tv-02.html
https://santaritasaude.azurewebsites.net/sup/video-Nikkan-v-Enj-fuji-tv-03.html
https://santaritasaude.azurewebsites.net/sup/video-Nikkan-v-Enj-fuji-tv-04.html
https://santaritasaude.azurewebsites.net/sup/video-Nikkan-v-Enj-fuji-tv-05.html
https://csicoverage.com/wod/video-Hawks-v-Rams-btvchd-01.html
https://csicoverage.com/wod/video-Hawks-v-Rams-btvchd-02.html
https://csicoverage.com/wod/video-Hawks-v-Rams-btvchd-03.html
https://csicoverage.com/wod/video-Hawks-v-Rams-btvchd-04.html
https://csicoverage.com/wod/video-Hawks-v-Rams-btvchd-05.html
https://csicoverage.com/wod/video-Buc-v-Was-liv-cnf-01.html
https://csicoverage.com/wod/video-Buc-v-Was-liv-cnf-02.html
https://csicoverage.com/wod/video-Buc-v-Was-liv-cnf-03.html
https://csicoverage.com/wod/video-Buc-v-Was-liv-cnf-04.html
https://csicoverage.com/wod/video-Buc-v-Was-liv-cnf-05.html


You can see that we have 2 microservices in this architecture. They communicate asynchronously by a Kafka Queue. Also, we have an API gateway, that is an interface for the external consumer, to communicate with the microservice 1. So, just for a simpler understanding, we will consider that the microservice 1 exposes an HTTP endpoint for a functionality that can be called by this external consumer. This same microservice 1 will trigger an event to the Kafka Queue that will be processed by the microservice 2.
Now, let’s deep dive into the details of the strategy behind each one of the tests:
Unit Tests: This is a kind of test technically always present in any test strategy. It is really fast to execute, cheap to create and maintain and can cover many different points of your application; It supports us to guarantee the behavior of some internal layers of our micro service, like controller, service, repository, etc.
Integration Tests: Here we have mainly 2 important responsibilities for those tests. It will be applicable in both microservices contexts of the architecture above:
Some integration tests will validate the integration with the Database. In this test, we can try to use an in-memory database for an isolated and independent execution. In most cases, it’s interesting to include all the MVC layers of a functionality here, in order to guarantee the integration of all the internal layers too;
The other integration tests will assist us to verify the connection with the kafka queue. When the microservice is a producer, we can validate that it is correctly publishing events into this Kafka Queue. And when the microservice is a consumer, we can test that it can pull events from the queue and process them. In both cases, it is interesting to try to use Embedded/In-memory kafka libraries to make those tests isolated and independent, also helping to avoid some possible flakiness.
Contract Tests: It has been increasing it’s popularity a lot over the last few years. It can help a lot to deal with interdependence issues between microservices. In our context here, it validates if the event contract that the microservice 1 is sending, it’s the same that the microservice 2 is expecting. The strategy includes a centralized Pact Broker to store those contracts. We can include this test in our CI pipeline, in order to validate this contract constantly wherever there is any change in the microservices.
E2E tests: One time that we have all the other tests covering many different components of the architecture, it will be necessary just a few E2E test to make some final checks of this architecture (this is an important point because this is the most costly type of test on our strategy, and we want to make it as much efficient as possible). The E2E tests will cover this external communication with our application, where it includes the API gateway that makes this interface. It is important to highlight that the microservice 2 is not covered in the E2E tests because we cannot check his behavior of consuming the kafka message. Because of that, it is even more important to have the other kinds of tests to cover it.
Depending on the infrastructure that you application is deployed, you can add other kinds of tests. For example, let’s say that everything is deployed on AWS using Infrastructure as a code with Terraform. You could also think about including tests for Terraform, that will help to guarantee that everything in your infrastructure is correctly configured to support your application. It could help a lot to anticipate some issues.
In conclusion, I would like also to mention that depending on other components of your architecture, this strategy can vary considerably. My recommendation is to always try to map some breakpoints and risks of your architecture, in order to create something efficient for your context.



Category : summer-vacation

Enhance Your Career With Most Popular Oracle 1Z0-1053-20 Certifications

Enhance Your Career With Most Popular Oracle 1Z0-1053-20 Certifications

- The innovation business is apparently the quickest developing vocation decision in most creating countries.transfer within your lifetime


Huawei H31-611 Certification Exams That You Need to Check Out

Huawei H31-611 Certification Exams That You Need to Check Out

- Does just one currently have a Bachelors diploma, but for irrespective of what purpose can not appear to be to obtain a task for which you


Six Nations 2017: Players to watch vegetist

Six Nations 2017: Players to watch vegetist

- Defending champion England was unbeaten in last years tournament and has gone 13 matches without de


London tram crash: 7 dead, dozens injured in Croydon farmost

London tram crash: 7 dead, dozens injured in Croydon farmost

- More than 50 people were taken to hospital with injuries after the tram derailed in the Croydon area