Testing of Microservices in a Cloud Environment
Amit Rawat
Hello!
I am Amit Rawat
I am here because I love to talk on Test
Automation.
“I am a Civil Engineer by qualification, a Test
Automation Architect by profession and a
Developer by passion.”
You can find me at:
Twitter/Medium: @sahajamit
Email: sahajamit@gmail.com
My BLog: http://www.amitrawat.tech/
Testing
of
Services(Micro)Services
Monolithic Applications
Positives of Monolithic Architecture
Image Source: https://dzone.com/articles/microservices-1-introduction-monolithic-vs-microse
Drawbacks of Monolithic Architecture
- has limitation in size and complexity
- too large and complex to fully understand and made changes
fast and correctly
- Re-deploy the entire application on each update.
- Impact of a change is not easily traceable and it leads to
extensive manual testing
- Single point of failure.
- Not flexible to adopt new technologies/languages
Microservices
Microservices Google Trends Growth Over 5 years
Microservices
Image Source: https://dzone.com/articles/microservices-1-introduction-monolithic-vs-microse
Microservices at-scale
Microservices at-scale
500+ services 500+ services
Why Microservices?
Image Source: https://dzone.com/articles/microservices-1-introduction-monolithic-vs-microse
● Services are small, independent and loosely coupled
● Each service is a separate code base managed by a small dev team
● Services can be deployed to production independently
● Services communicate to each other using a well defined api
(contract/schemas)
● Services do not need to share the same tech stack, libraries or
frameworks
● Responsible for persisting their own data
Microservices Anti-patterns
Microservices Anti-patterns
● Breaking the monolith in to pieces without intentional
division of services either by domain or unit of work
you end up creating several mini monoliths.
● Everything micro except data
● Relying on consumer sign-offs
● Building a gateway in every service
Testing the entire stack of Microservices
Source: https://twitter.com/simform/status/1133352132013199366
Testing Pyramid
Infamous Testing Pyramid
Source: https://www.slideshare.net/AlperMermer/test-automation-architecture-in-microservices
Test Automation Pentagon
A B C
D E F
Component Tests
Source: https://alexromanov.github.io/2019/04/02/spring-boot-docker-containers/
Contract Testing
What is a contract?
Source: https://www.atlassian.com/blog/technology/spec-first-api-development
User Service
Billing
Service
Breach of Contract
Source: https://www.atlassian.com/blog/technology/spec-first-api-development
User Service
Billing
Service
PACT to the rescue
Consumer side verification
CONSUMER
Billing
Service
PROVIDER
User
Service
Request
Response
Pact Mocked Provider
Producer side verification
CONSUMER
Billing
Service
PROVIDER
User
Service
Request
Response
Pact Mocked Consumer
Contract Testing: Take 2
Source: https://docs.confluent.io/current/schema-registry/index.html
End-to-end Journey tests
● Try to have as few end-to-end tests as possible.
● Focus on important user journeys
● Use Infrastructure as a code for repeatability
● Make your tests data-independent
Source: https://www.hanoverresearch.com/insights-blog/4-tests-measure-customer-journey-mapping/
Non-Functional Testing in Microservices
● Resilience / Fault-tolerance Testing
● Chaos Testing
● Config and Service Discovery testing
● Elasticity Testing
Resilience Testing
● Fallbacks
● Retries
● Timeouts
● Circuit breakers
Chaos
Testing/Experiments
Monkey Testing
Monkey creating chaos in cloud
● Adding latencies
● Microservice/s failure
● Node failure
● Region Failure
● Cascading failures
Not If this fails,
but when it fails
Cultural Shift
Config Testing
Elasticity or Auto-scalability testing
Let’s Conclude
Source: https://medium.com/@copyconstruct/testing-microservices-the-sane-way-9bb31d158c16
Shift Left Shift Right
Testing of Microservices in a Cloud Environment

Testing of Microservices in a Cloud Environment

Editor's Notes

  • #3 Test Notes
  • #6 El Captain Dawn Wall
  • #17 Louvre Pyramid (Pyramide du Louvre) of Paris
  • #21 Louvre Pyramid (Pyramide du Louvre) of Paris
  • #35 Chaos doesn’t creates problem but it reveals them.