How to Test a Microservice Architecture Application

Arnab Roy Chowdhury

Posted On: August 3, 2018

view count185665 Views

Read time5 Min Read

If you are working in the testing domain, you probably have heard about microservices. Many organizations who have moved into modern DevOps practices are also investing in converting or building new projects into Microservice based architecture. Being a new technology, it comes with certain challenges, especially in the testing domain. Testers, especially web testers, are now figuring out new ways of automation testing approach in the world of microservices. Before digging deeper, let’s understand what is microservices.

Understanding How Does It Work

There are usually 2 ways of developing an application. The most commonly used type is

  • Monolithic Application

    A single application is consisted within one process in Monolithic Applications. Microsoft word is a very common example. A group of classes are used while developing these applications that depends on each other. When a change is made in one class, it will impact the others. Hence, any minor change in the application will result in rebuilding and deployment of the entire application.

  • Microservices
  • The other type is Microservices, a collection of focused and small services which, on execution develops a complete application. A single responsibility of the application which you are developing is represented by an instance of a microservice.

Before testing a microservice application, a developer needs to perform the following strategies

  • Ensure the code branch is correct.
  • Pull the latest code from repository.
  • Ensure dependencies are all updated.
  • Rerun if there is any database migration.
  • Start the service.

UI Testing Tool

Challenges Behind Testing Microservices

From the beginning, extra precautions are required for testing microservices, like managing multiple repositories, each having their own database. While testing, challenges may get deeper.

  • Opportunity

    Since different teams manage their own microservices, getting an opportunity when all microservices are available for testing is difficult

  • Fragmented testing

    Microservices are developed to run solo or with other loosely connected services. Testers not only need to test the entire application, but also each individual component.

  • Knowledge

    Before writing the test cases, the tester should have a strong knowledge of each service.

However, advantages of microservices are too great to let go because of simple testing challenges. Let’s discuss certain strategies a tester must undertake before testing microservices

You can also refer to our blog on Testing Challenges related to Microservice Architecture for detailed information.

Browser Compatibility Testinng

Scalability Testing

In order to check whether the microservice is independent and agile, testing scenarios should be executed to check whether its scalable or not. Testers need to ensure whether

  • With increase in load, the microservice replicates effectively to balance the load.
  • To check whether replicated microservices can collectively accomplish a task.

For example, let’s say an application like Accuweather is developed using microservices. It constantly gets updated with changing weather. It renders the image of the current weather from one microservice and the recorded temperature from another. When the widget is rendered multiple times, because of complications in caching, an older image may get rendered. Proper automation testing tools like LoadUI Pro can run test case scenarios at any granular level and with a single click, scalability of the app can be tested.

run test case scenarios

Functionality Testing

Apart from individual implementation of features, a microservice has its own data source. Not only that, it also encapsulates a domain. As a result, individual testing is required to ensure whether it can implement the feature it was designed for. If implementation is done in a container, it becomes easier to pull and test the functionality of an individual microservice.

Enterprise grade automation tools like SoapUI Pro or any other API testing tool, gives you the ability to test all probable scenarios like looping over different test cases or microservice endpoints with different data sets.

Functional Testing Tool

End to End Testing

As mentioned earlier, end to end testing is a critical procedure for testing microservices, since tester needs to test each and every individual component to ensure that the integrated application serves the goal it was meant for. A proper strategy for end to end testing is to limit the number of times test cases are executed. A healthy balance between end to end along with other testing strategies will filter out even smallest issues. In a large application, end to end testing will take more time and chances are there to get it wrong. Hence, it should be left for the end when all other testing procedures are completed.


download whitepaper

User Interface Testing

It is probably the highest order, since it allows the tester to understand how the application will behave when used by an end user.

While dealing with UI testing, instead of relying only on automation tools, tester should also think from the perspective of a user and figure out how the application feels and behave. All the interfaces, third party and internal services along with databases should work perfectly in a well-coordinated manner to produce the result that is expected.

Apart from the above-mentioned strategies, other strategies that can be undertaken for microservice testing are

  • Documentation first
  • Stack in the box
  • AWS Testing
  • Shared testing instances
  • Stubbed service

Testing microservices may not be a piece of cake and a lot of additional work and research may be needed since the technology is new in the industry. However, the extra effort is worth the benefits.

Author Profile Author Profile Author Profile

Author’s Profile

Arnab Roy Chowdhury

Arnab Roy Chowdhury is a UI developer by profession and a blogging enthusiast. He has been writing content for about 5 years and has strong expertise in technical blogs, travelogues, and content in the latest programming languages.

Blogs: 76



linkedintwitter

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free