Testing Microservices vs Monolithic

Japneet Sachdeva
4 min readFeb 27, 2024

--

Understanding systems or applications from architectural perspective gives really improved approach of testing for testers. Now as world is moving towards using AI for our common needs and reducing our efforts. We need to improve ourselves in Higher Level and Lower Level system understanding.

So today, as part of this I am going to provide approach and architecture understanding of Higher Level Systems. Such as Microservices and Monolithic architectures. We will discuss about How these architectures are different and how to test it?

Take a look at my course with E-books created specifically for SDET and future SDET managers: Link

Monolithic: is a software application that typically contains all the code in a single code base. The server-side application, the API endpoints, business logic, data model and background jobs, etc., are all defined in the same codebase. This means that if developers want to make any changes or updates, they need to build and deploy the entire stack all at once.

As can be seen in infographic above each component like UI, Business logic and data storage, access are kept within single large component. Which means the entire codebase resides together.

Advantages:

  • The development phase is straight forward.
  • End-to-End testing can be easily implemented using tools like Selenium & PlayWright etc.
  • The deployment package to the server is very simple to deploy.
  • It is easy to scale the instances horizontally by running multiple copies behind a load balancer.

Disadvantages:

  • Low Flexibility as tech stack once selected cannot be changed or updated later on, as it becomes really challenging.
  • Deployment becomes challenging as the whole application needs a single package creation and deployment. Even for small updates.
  • Low reliability, cause if one service goes down entire application can be hampered.
  • Scalability issue: In 2011, Uber, with UberBLACK as its sole product in San Francisco, ran on a monolithic architecture. As Uber’s services expanded globally, they started facing integration and scalability challenges in their codebase. By 2015, these complexities prompted Uber to follow tech giants like Amazon, Netflix, SoundCloud, and Twitter, transitioning from Monolithic to Microservices Architecture.

Become a successful Test Architect with Full Stack QA: Link

Testing Strategy for Monolithic System:

Automated Tests using regression testing can be helpful for catching early stage bugs

End to end testing is the most suitable aspect for Monolithic based applications

API & Database tests can also be really useful in such cases as the whole application is one and data creation, using same data for further testing can be easily integrated in automated tests. Integration tests can be easily conducted

Performance tests are really crucial cause if one part of application crashes then whole application can face downtime

Major drawback is isolated component testing is really challenging to conduct

Microservices: splitting the application into small services, and these services are independent of each other (loosely coupled). Working with microservices also demands more experience and seniority from the development team.

As shown in the image above, the UI connects with one or more microservices, and these microservices can communicate with each other by synchronous or asynchronous communication. Also each microservice has it’s own database.

It’s also possible to use an API Gateway for managing the incoming and outgoing API requests. What is API Gateway?

An API gateway acts as a single entry point for clients to access various backend services in a microservices architecture. It sits between clients and services, handling tasks like:

  • Routing requests to the appropriate backend service based on the URL and method.
  • Security enforcement like authentication and authorization.
  • Traffic management to handle scaling and load distribution.
  • Monitoring API usage and performance.

Testing API Gateways:

  • When to test? Throughout the development lifecycle:
  • Unit tests: During development to verify individual components like request routing and response formatting.
  • Integration tests: To ensure proper interaction between the API gateway and backend services.
  • Functional tests: To validate overall API functionality from a client’s perspective.
  • Security tests: To identify and address potential vulnerabilities.
  • Performance tests: To assess the API’s ability to handle expected load.

Tools like Postman, Swagger, JMeter etc. can be used.

Crack test automation interviews using Java: Link

Advantages of Microservices:

  • Flexibility to scale any service as required
  • Each service can be updated anytime and deployed
  • Less or no downtime if one of the service is not working
  • Easier to understand and implement as codebase remains comparatively tight

Disadvantages:

  • Data consistency becomes challenging to maintain
  • Debugging during errors requires drilling through logs
  • Automated deployments are really important for microservices
  • Async communication can become challenging to maintain

Testing Strategies:

Automated Tests using regression testing can be helpful for catching early stage bugs

Major Advantage: Isolated component testing is very easy to conduct

Contract Testing: Thorough API & Database tests can also be really useful in such cases as the whole application is one and data creation, using same data for further testing can be easily integrated in automated tests. But integration tests can be challenging to setup.

Performance tests are really crucial cause if one part of application crashes then whole application can face downtime

Major drawback End to end testing is the most suitable aspect for Monolithic based applications

Quick releases of application can be done once testing phase is successful

@LambdaTest

-x-x-

If you are looking to build your career in QA/Test Automation/SDET then you can schedule a call with me here: https://topmate.io/japneet_sachdeva

Subscribe to my YouTube channel: https://www.youtube.com/@IamJapneetSachdeva

My LinkedIn for everyday new content: https://www.linkedin.com/in/japneet-sachdeva/

#japneetsachdeva

--

--

Japneet Sachdeva
Japneet Sachdeva

Responses (2)