Automation Testing in Microservices - Five Types Of Automation tests


Automation tests are a very important requirement to have highly successful microservice architectures. In order to take things live on a frequent basis, it is imperative to have great automation tests. In this article, we talk of the five kinds of automation tests that you can write, for your microservices.

This is first article in a series of 4 articles on Automation Testing in Microservices

Unit Tests

When you develop an application, it could contain a large number of classes, each of which probably has several methods. You normally write a test case for a particular unit of code. A unit could be a method, a group of methods, or the entire code of a class. Typically, you want to keep the individual unit tests as independent as possible.

A common approach to unit testing is to mock external dependencies, for effectively testing the business logic. For example, a unit test could be run independent of a database. This ensures that tests do not have external dependencies and do not fail when something external to the test changes.

Layer Integration Tests

When we develop enterprise applications, we generally structure them into layers. For instance, a web applications could have web, business and data layers. You would want these separate layers to work well together. Therefore, you write layer integration tests to ensure their proper integration.

For example, when you make a call to the web layer, is it being propagated correctly to the business layer, and from there to the data layer? Finally, are you getting a proper response to the request?

API Tests

When we create a microservice, we end up offering APIs for the consumers to access and consume resources. Examples are REST and SOAP APIs. You can test an API by writing an automation test for it. Even for such API tests, the need of the hour is an in-memory database, as it is good to avoid external dependencies.

System Tests

Here is where all the systems external to our application come into the picture, during testing. You would start accounting for databases, external interfaces and other dependencies needed by your application. This is where you actually deploy your application in a real-world environment.

User Acceptance Tests

This is the final level of automation testing, where you test every aspect of the end-user usage scenarios. The focus here is on creating real-time usage scenarios, such as accessing a production-mode database for testing the logic. This step is necessary before you take the application live.

Do check out our video on this:

image info

Summary

In this article, we explored the five different kinds of automation testing that is generally performed on applications. These are unit testing, layer integration testing, API testing, system testing and user acceptance testing.

Congratulations! You are reading an article from a series of 50+ articles on Spring, Spring Boot , Hibernate, Full Stack, Cloud and Microservices. We also have 20+ projects on our Github repository. For the complete series of 50+ articles and code examples, click here.

Join 300,000 Learners!

Learn Spring Boot in 10 Steps - FREE Course

Next Steps

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Related Posts

Spring Boot Tutorials for Beginners

At in28Minutes, we are creating a number of tutorials with videos, articles & courses on Spring Boot for Beginners and Experienced Developers. This resources will help you learn and gain expertise at Spring Boot.

Spring and Spring Boot Video Tutorials for Beginners

At in28Minutes, we are creating a number of tutorials with videos, articles & courses on Spring Boot for Beginners and Experienced Developers. Here's a list of video tutorials and courses for you

What is an In Memory Database?

In this article, we understand what the term "In-Memory Database" actually means. We see what scenarios they can be used, and why they are important.

What is an Embedded Server?

In this article, we focus in exploring what an embedded server is, and how they help make application deployment simpler.

Java Tools and Frameworks - Introduction To Maven

In this article, we experience a brief introduction to Maven, and will see how it helps in managing your project dependencies.

Five Tools To Learn as a Java Developer

In this article, we introduce you to five great tools that we recommend every Java Developer to learn.

Five Languages To Learn as a Java Programmer

As a programmer, you want to explore new things. Learning a new language gives you a different perspective when solving problems. What are the 5 languages that a Java developer should explore?

Five Great Frameworks To Try for Java Programmers

As a programmer you want to explore new languages and frameworks. What would be the best frameworks to explore in 2019 for Java Programmers?

Unit Testing Best Practices - with Java and Junit Examples

Unit Testing is often underrated. As far as I am concerned, having good unit tests seperates good projects from bad. In this article, let's look at unit testing best practices in depth. We use examples from Java and JUnit to illustrate the concepts. However, the best practices are applicable irrespective of the programming language used.

Programming Basics - Unit Testing - What Is Mocking?

Mocking is an important concept that is made use of, when writing unit tests. In this article, we explore what mocking is all about, and explore some of the popular Java mocking frameworks in use.