As with all software development it is crucial to implement a solid test framework to verify and adopt when implementing Microservices. And a solid test framework might be even more important when you implement a Microservices strategy. Why? Because an important objective behind the initiative often is to decrease time from development to production and to do this you have to minimize the requirement for manual testing.
Before you start developing your Microservices, there are a few things to consider. Through our previous Microservices Ready Model blog posts we have covered the most of them, but testing is an important aspect of your initiative that you need to put some thinking into before you get started. When you design the test strategy for your Microservices, you should make sure to cover as much as possible with automated tests. This ranges from functionality to integration and load/performance tests. With a well designed test strategy that covers all of these aspects, you can feel certain that your Microservice will perform when it is deployed to acceptance and production environments.
Verify the functionality
When it comes to functional testing you should make sure that you have the tests written to verify that the Microservice delivers the desired results before you start developing your Microservice. With this strategy it is easy to verify the functionality when originally developed and committed, but also when you do modifications and new future commits. With solid test scripts you can automatically deploy your Microservice through your pipelines.
Besides testing the functionality of your Microservice, you should ensure that the tests include the most important sections mentioned in a previous post. Our recommendation is that you enforce developers to ensure that developed Microservices follow the fundamentals of your guidelines. One such important thing to verify is that each Microservice can operate by itself and that it is not dependent on a chain of Microservices or information. This can be tricky to test, but with a proper strategy it is possible to achieve.
Automate code quality testing
With modern tooling it is possible to automate code quality testing. One example is ”Sonarcube” that assists with tests on important measures such as code duplication, test coverage, documentation coverage etc. If you put your Microservices code to the test through Sonarcube, it will give you insight into and rank your piece of code based on the above listed criteria. With a good enough ranking, you can let your code automatically pass on to the next step of the pipeline, but if it fails and the ranking is to low you will have to address the issues before it is committed further. This is why it is easier to automate code quality testing today and why it should be made an integral part of your Microservices test strategy.
Put your entire platform to the test
Further down the pipeline you should make sure to design load/performance tests to ensure that your Microservices continue performing when put to the test. These tests should of course put your entire platform to the test. To achieve this final test before release to production, you should stress test the entire platform. You do this by hammering the platform and Microservices to find possible flaws in a specific Microservice or if the platform does not perform as expected. Luckily there are great automated tools to do this nowadays. With a successful performance test you are ready to commit to production.
This blog post concludes the Microservices Ready blog post series. I hope that the Microservices Ready Model will give you inspiration and an idea on how to set up your Microservices strategy to achieve the benefits of such an initiative and to avoid some of the potential pitfalls. For assistance, presentations, inspiration and discussions on the possibilities, challenges and opportunities with Microservices – don’t hesitate to get in contact with us.
Learn more about our Microservices Ready model here