Q
Get started Bring yourself up to speed with our introductory content.

Testing microservices? The secret is in the details

Microservices are the hot new thing, so testers need to get ready. Expert Tim Western explains why you'll need to problem solve -- and relax. You've got this.

My company has been talking about transitioning to microservices. What are the important things to know from a...

test and quality perspective?

Like the advice to the heroes in The Hitchhikers Guide to the Galaxy: don't panic. Yes, microservices is a new buzzword, but getting to adopt and roll with new trends is how we develop professionally. Sometimes, these new ideas -- like testing microservices -- are actually refinements applied to a very old idea. As the new waves crash over the beach, the answer is the same as it always was: keep calm and continue testing.

Microservices as a strategy boils down to creating interfaces -- typically APIs -- to expose business processes. Wrapping services like create member, create claim, pay bill, search and so on makes it possible to compose applications by stitching together API calls with a user interface on top. That's not really new, but the emphasis is different. With microservices, the goal is to refactor these services into smaller contiguous parts so it will be easier to balance, load and interact with the APIs. The goal of microservices is to have modules that handle certain entities or tasks that are all done through a specific well-defined API, for example, REST.

The impact of microservices is easier reuse, easier refactoring and less code because the code is DRY -- don't repeat yourself and more concise. At the end of this logical conclusion, the company has a large number of public microservices, each created to handle specific issues.

For example, imagine a program like Google Maps that may interact with a login service that handles authentication and fetching of user preferences for use of the maps. It may have a directory of businesses archived by GPS coordinates along with their names, addresses and telephone numbers. Now imagine that login service we mentioned gets more load than the rest of the functionality, you might not want to spin up whole servers for Google Maps. Instead, choose to distribute the login service in a manner that could be both load and geographically balanced. Keep it insulated from some of the uptime and downtime issues that might impact it if it was on the same server as the directory service that the Maps application interacts with.

Testing microservices

So what are some things to consider when testing microservices from a quality perspective? I would first look at the API. Is it REST? Is it using Internet of Things Database, Message Queuing Telemetry Transport or some other protocol or standard? Identifying the type of interfaces being used will open knowledge for how to build some requests to communicate with the underlying microservice. You might then want to look at a tool like Ready! API, cURL, HTTPie, Postman or some other tool like Fiddler that enables you to see the requests as they are built and interact with them.

Of course, it is likely that management doesn't know the answer to that. They are just looking at microservices. That is a fantastic opportunity for you. Don't complain that these people are "idiots" who "don't know what they are doing," be part of the solution: read a few books over the weekend, come up with your own ideas and suggest things. Make assumptions about how things will work so you can drive forward. At worst, this will force other people to decide -- but it is more likely that they will just go with what you decided.

Next, ask or help figure out how the service is deployed. Does it require a pre-distributed access key? Does it require some type of authentication -- HTTP Auth, oAuth? Does it handle authorization -- access based on user or role type? Then, you could dig and look at how it handles data types for certain calls. Does it let you change data with a POST or a PATCH call? Does it handle invalid characters gracefully, and is it able to throttle requests when under unexpectedly high load from a given user?

From there, you may find other things of value. For example, look at the client applications. Do the clients handle API errors gracefully? You can test that by using stubs that return errors or nothing. You might look at the published contracts for the microservice and see if what is returned is consistent and acts in a way that is intuitive and reliable to a user.

Get going

First, read about the type of microservice that is being used or built and consider tools that can help you better test and compare results. Then, evaluate details of how it is implemented, how that compares to other similar services, and how the API and clients will behave when confronted with exceptional conditions or when users try to use it in a way it may not be intended. What happens if the microservice goes down, and does your application cover it gracefully?

There is a lot of fodder there to consider, but the more you learn about testing microservices, the better understanding you may have in the long run. 

Next Steps

Are microservices the new documentation nightmare?

Microservice architecture for mobile -- yea or nay?

Onboarding can help improve microservices projects

This was last published in April 2016

Dig Deeper on Stress, Load and Software Performance Testing

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Join the conversation

4 comments

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What resources have you found helpful when learning more about adopting microservices?
Cancel
As I mentioned in a previous post, there’s an excellent slide deck out on Martin Fowler’s site called “Testing Strategies in a Microservice Architecture.” It provides an excellent overview of both microservice architecture and how testing strategies can be adjusted to address the challenges that architecture introduces.
Cancel
I definitely find microservices to be very challenging to test. I think that one of my biggest issues is that I don't feel comfortable testing by just viewing a request or verifying a message contract, because it doesn't tell me whether the system is going to achieve its business goal.
Cancel
There’s an excellent slide deck out on Martin Fowler’s site called “Testing Strategies in a Microservice Architecture” that you might want to go through. I think it does a nice job of discussing the different levels of the architecture, and tying the prices together to help understand how the system achieves the business goals.
Cancel

-ADS BY GOOGLE

SearchMicroservices

TheServerSide

SearchCloudApplications

SearchAWS

SearchBusinessAnalytics

SearchFinancialApplications

SearchHealthIT

Close