What is MicroService?
Traditionally, applications have housed all functionality in one single process. Then came an era of SOA (Service oriented architecture). The latest in this series is the concept of MicroServices. I have tried to summarize the concept of Microservices in this article, from a tester’s point of view.
MicroServices architecture offers a suite of services, like in distributed software systems. Each MicroService is a standalone software module that provides a specific set of capabilities; they can each be scaled, managed and deployed independently. A collection of MicroServices builds a logical system which internally communicate to each other across the network through a gateway; a well-defined set of rules and contracts are typically used to deliver logical functionality.
Monoliths vs. MicroServices
A monolithic service-oriented architecture deployment entails rebuilding the entire monolith anytime there is even a small change, which proves to be a time-consuming task. This process is time consuming, error prone and also overhead involved.
On the other hand, a microservice architecture offers a unique capability enabling each microservice to be self-managed. This offering gives a platform to build software with a decentralized approach by allowing each service to be managed independently.
Objective of Using MicroServices
- Each functionality is loosely coupled to support SaaS/SOA architecture. MicroServices can be distributed across the platforms over the network and integrated through REST over HTTP
- Every service can be maintained, upgraded and tested independently which is an essential requirement for a SaaS architecture. This makes microservices an easy enabler of continuous delivery supporting frequent releases yet offering high system availability and stability.
- Each microservice can be scaled independently as per usage. Each service can be deployed on independent hardware according to resource requirement which was not possible in the traditional monolithic design approach.
- Each microservice can be independently designed and deployed for failover and fault tolerance. For example, issues like memory and CPU utilization can be handed locally while other services continue to work normally.
Test Strategy for MicroServices Architecture
MicroServices testing requires a different approach – the test team should strategize a way to start testing microservices in the design phase itself. Test team’s early involvement with design/architecture group to understand functionality, its usage and exposed interfaces will certainly prove helpful. In addition to the above, testers should make sure that all interfaces are generic so other systems/services could be consumed without hurdles. Some core areas of testing in microservices include:
- Test driven development (TDD) should aim at making sure all pieces of functionality, however small work as expected.
- Make sure tests have a good coverage at the following layers:
- Specific functionality of each service should be tested independently
- All interfaces should be well defined so that services are able to communicate with other systems/services through gateway
- Testing of the service should be targeted across platforms and systems
- Microservices operation as a suite of services, should be tested
- Testing the suite for end to end business work flow is important
- Business rules validation, error handling and logging will need to be tested
- This should aim at verifying the bundling and packaging of each service to support functionality in standalone mode in a distributed architecture
- The tester should also ensure each service has self-correcting mechanism and should be able to scale up or down independently
- The tester should test communication and integration of services across boundaries/interfaces
- Service communication as per defined contract through gateway needs to be checked
- Automated tests should be written to cover end to end integration tests
System testing for microservices would require the tester to test:
- The entire system end to end black box
- Data synchronization across services and components
- Use case/persona based testing
- Performance testing would entail testing of individual services and end to end system as a whole for performance SLAs around:
- Load /stress
- Response time and throughput
- Resource consumption and
- Volumetric capacity
- Security: The tester should ensure all microservices are secure and adhere to the following guidelines:
- SQL Injections
- Buffer Over Flow
- Bad Parameter
- Leak testing
- Access Control
As the digital revolution continues, we will increasingly see more and more of microservices engineered. Testers need to build a robust test strategy to focus on testing these services, more so in an automated manner. Hopefully this article has given you a good overview to get started and think about testing for this set in the coming days.
Article contribution – Satish Kumar:
Satish Kumar is a Test Engineering Manager, Agile Evangelist, Design Thinker, and Cloud Transformation Consultant with 15 years of diverse experience in brining products to market. He is passionate about solving market and business problems by conceptualizing and building user-centric products that delight customers while helping PEOPLE (individuals, teams and organizations) realize their true potential. He has an excellent professional track record and niche skill set ranging from Product Innovation & Systems Thinking, User Experience Design & New Product Development, Lean Start-ups & Agile Organizations. Satish has published technical papers in international conferences & events. Currently, he heads the software quality function at Homeshop18(E-commerce). Previously he has worked at Kronos, Pitney Bowes, Wipro, British Telecom-UK & Lumenare Networks-USA. He holds a master’s degree in computers from NIT, Allahabad (formerly REC). Satish enjoys playing Golf & Squash.