Before Test Automation
Developer Tester
Shane Galvin @ Devopsdays Galway 2018
E2E Tests
Service Tests
Unit
Tests
Test Automation - Anti-Patterns
Manual Tests
Ice Cream Cone Hour Glass/Smoke Stack
Service
Tests
E2E Tests
Unit Tests
Manual Tests
Test Automation Pyramid
E2E
Journey
Tests
Component Tests
Integration Tests
(Contract Tests)
Unit Tests
Speed Scope
$$$$
cents
Costs
Higher
ROI
Quantity
Adapted from Mike Cohn (Succeeding with Agile: Software Development Using Scrum (2009)), and Martin Fowler https://martinfowler.com/bliki/TestPyramid.html
More Time
& Effort
Microservice Pull Request Pipeline
(Run on every microservice code commit)
Image: order-service
Tag: 1.0.23artifactId: order-service
version: 1.0.23
Component Tests
Unit Tests Integration
Tests
Contract Tests Build Jar Build Image
Create Helm
Chart
Auto Deploy
Isolated
Kubernetes
Namespace Chart: order-service
Version: 1.0.23
Resources (REST)
Service
Layer
Domain
Repositories
Microservice Boundary
Data Access Layer (DAL)
Pub/SubLayer
HTTPClient
Our Standard Microservice
Topic 1
•Msg1
•Msg2
Topic 2
•Msg1
Database
External
Microservice
REST
Container Boundary
Unit Testing
Resources (REST)
Service
Layer
Domain
Repositories
HTTPClient
Pub/SubLayer Service Boundary
“77% of the failures found in prod can be reproduced by a unit test” [1]
Run Tests in Parallel
Focus Areas
[1] Source (http://www.eecg.toronto.edu/~yuan/papers/failure_analysis_osdi14.pdf)
Data Access Layer (DAL)
Be Lazy and try:
• Lombok
• Schema & API Auto Generation
(i.e. Swagger, Avro etc)
Integration Testing
Embedded
Mock
HTTP
Service
Network Access
Embedded
Database
Topic1
•abc
Topic2
•def
Embedded
Messaging
Embedded HTTP Client
Resources (REST)
Service
Layer
Domain
Repositories
Data Access Layer (DAL)
Service Boundary
Pub/SubLayer
HTTPClient
Testing Framework Boundary
Focus Areas
Embedded
Dependencies
<dependency>
<groupId>pl.allegro.tech</groupId>
<artifactId>embedded-elasticsearch</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.arivera.oss</groupId>
<artifactId>embedded-rabbitmq</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed<groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope>
</dependency>
Java Embedded Alternatives
<dependency>
<groupId>com.github.kstyrc</groupId>
<artifactId>embedded-redis</artifactId>
<scope>test</scope>
</dependency>
Contract Testing
To Prevent Microservice Integration Hell
Services that interact via API’s Services that interact via Events
ConsumerConsumerConsumer(s) Pact
Mock
Pact
File(s)
Request
Response

“Agreement between the Consumer and Provider about the
format of data that they transfer between each other.”
Publishes
Consumer(s) Pipeline
GET: http://localhost:8080/user/1
Response: 200 OK
{
"id": 1,
"name": ”Joe Soap",
"username": ”joesoap",
"email": "joesoap@gmail.com"
}
Consumer Driven Contract Testing with Pact
(for services that interact via REST & JSON)
ConsumerConsumerConsumer(s) Pact
Mock
Pact
File(s)
Request
Response

Provider
Request
Response

“Agreement between the Consumer and Provider about the
format of data that they transfer between each other.”
Publishes
Consumer(s) Pipeline Producer Pipeline
GET: http://localhost:8080/user/1
Response: 200 OK
{
"id": 1,
"name": ”Joe Soap",
"username": ”joesoap",
"email": "joesoap@gmail.com"
}
Response: 200 OK
{
"id": 1,
"name": ”Joe Soap",
"username": ”joesoap",
"email": "joesoap@gmail.com"
}
GET: http://localhost:8085/user/1
Consumer Driven Contract Testing with Pact
(for services that interact via REST & JSON)
Schemas like Avro
(for services that interact via Kafka Events)
{
"type" : "record",
"name" : "userInfo",
"namespace" : "my.example",
"fields" : [
{"name" : "username", "type" : "string"},
{"name" : ”address", "type" : "string"},
{"name" : ”town", "type" : "string"},
{"name" : ”county", "type" : "string"},
{"name" : "country", "type" : "string"},
{"name" : "age", "type" : "int"}
]
}
Producer ConsumerKafka
Schema
Registry
Send Schema Get Schema
Send Avro
Message
Read Avro
Message
Benefits:
• Centralized Schema Location
& Data Discovery
• Safe Schema Evolution
• Resilient Consumers
• Storage and computational
efficiency
• Encourages Collaboration
Continuous Deployment Testing
Use Prod like staging environments,
and repeatable deployments
So now you have completed your build tests,
and have a versioned artifact….What’s next?
Use Testing Framework Features
or Docker Compose to create
test environments
“Kubernetes is open-source system for automating
deployment,scaling, and management of
containerized applications”
“Helm helps you manage Kubernetes applications
— Helm Charts helps you define,install, and
upgrade even the most complex Kubernetes
application”
helm upgrade
--name ServiceA
--namespace dev
--replicas 1
set DB.persistence.enable=false
charts/ServiceA
Deployment Flexibility with Helm
ServiceA
ServiceA
ServiceC
prodpull-request-1
requirements.yaml
dependencies:
- name: Kafka
- name: Wiremock
requirements.yaml
dependencies:
- name: Kafka
- name: Service-B
- name: DB-B
- name: Service-C
- name: DB-C
- name: Service-D
helm upgrade
--name ServiceA
--namespace prod
--replicas 3
charts/ServiceA
Kafka
DB-B DB-CWireMock
ServiceB
ServiceD
Kafka
Kafka
Kafka
ServiceA
ServiceC
ServiceB
Kafka
Database
ServiceA
Kafka
ServiceB API
ServiceC API
Isolated Kubernetes
Namespace (Pull Request)Production Kubernetes
Component Testing
(Testing Kubernetes Services in Isolation)
Test Framework
Database
ServiceD
Kafka
Kafka
ServiceA
ServiceC
ServiceB
Kafka
Database
ServiceA
Kafka
ServiceB API
ServiceC API
Isolated Kubernetes
Namespace (Pull Request)Production Kubernetes
Component Testing
(Testing Kubernetes Services in Isolation)
Test Framework
Database
ServiceD
Tools for Local Dev Testing
Local Kubernetes Environments
Kubernetes for Docker
Automate build -> push -> deploy from Local Dev Environment
Debug Locally, as if it was running Remotely
Key Takeaways (1/2)
 Consumer Driven Contract Testing and Schema
Registries make integrations easier, and promote
safe schema evolution.
 Helm charts facilitate rolling upgrades and flexible
configurations when deploying to different
kubernetes environments.
Key Takeaways (2/2)
 Embedded tools give you a high degree of
confidence by facilitating integration and contract
testing early in the pipeline (-> fast feedback).
 However embedded tools should never be the end
goal, and you still need to test your services in
isolation on Kubernetes prod like environments.

More Related Content

PDF
KSQL---Streaming SQL for Apache Kafka
PDF
Azure Serverless Toolbox
PDF
Infrastructure as Code for Beginners
PPTX
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
PPTX
App fabric introduction
PDF
ECS and ECR deep dive
PPTX
Best Practices with Azure & Kubernetes
PPTX
Continuous integration testing 2019 08
KSQL---Streaming SQL for Apache Kafka
Azure Serverless Toolbox
Infrastructure as Code for Beginners
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
App fabric introduction
ECS and ECR deep dive
Best Practices with Azure & Kubernetes
Continuous integration testing 2019 08

Similar to Microservice Automated Testing on Kubernetes (20)

PDF
Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...
PDF
Continuous Delivery at Snyk
PDF
Containerised Testing at Demonware : PyCon Ireland 2016
PDF
[QE 2017] Dawid Pacia, Tomasz Janiszewski - SQA w erze TestOps
PDF
Atmosphere 2018: Yury Tsarev - TEST DRIVEN INFRASTRUCTURE FOR HIGHLY PERFORMI...
PDF
Continuous Integration Testing: Fully test your microservices application, ea...
PDF
End-to-end testing in complex GitOps environments
PDF
"To cover uncoverable", Andrii Shumada
PPTX
Testing microservices with docker
PPTX
АНДРІЙ ШУМАДА «To Cover Uncoverable» Online WDDay 2022 js
PPTX
Test Automation Architecture in Microservices
PDF
Software Testing
PPTX
Webinar: Accelerate Your Inner Dev Loop for Kubernetes Services
PPTX
Continuous deployment of polyglot microservices: A practical approach
PPTX
Test Strategies in Microservices
PDF
Continuous (Non)-Functional Testing of Microservices on k8s
PDF
Использование AzureDevOps при разработке микросервисных приложений
PDF
2022-05-23-DevOps pro Europe - Managing Apps at scale.pdf
PDF
Prod-Like Integration Testing for Distributed Containerized Applications
PDF
"Production Driven Development", Serhii Kalinets
Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...
Continuous Delivery at Snyk
Containerised Testing at Demonware : PyCon Ireland 2016
[QE 2017] Dawid Pacia, Tomasz Janiszewski - SQA w erze TestOps
Atmosphere 2018: Yury Tsarev - TEST DRIVEN INFRASTRUCTURE FOR HIGHLY PERFORMI...
Continuous Integration Testing: Fully test your microservices application, ea...
End-to-end testing in complex GitOps environments
"To cover uncoverable", Andrii Shumada
Testing microservices with docker
АНДРІЙ ШУМАДА «To Cover Uncoverable» Online WDDay 2022 js
Test Automation Architecture in Microservices
Software Testing
Webinar: Accelerate Your Inner Dev Loop for Kubernetes Services
Continuous deployment of polyglot microservices: A practical approach
Test Strategies in Microservices
Continuous (Non)-Functional Testing of Microservices on k8s
Использование AzureDevOps при разработке микросервисных приложений
2022-05-23-DevOps pro Europe - Managing Apps at scale.pdf
Prod-Like Integration Testing for Distributed Containerized Applications
"Production Driven Development", Serhii Kalinets

Recently uploaded (20)

PDF
CEH Module 2 Footprinting CEH V13, concepts
PDF
“Introduction to Designing with AI Agents,” a Presentation from Amazon Web Se...
PDF
Human Computer Interaction Miterm Lesson
PDF
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
PDF
Altius execution marketplace concept.pdf
PPTX
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
PDF
The AI Revolution in Customer Service - 2025
PPTX
Presentation - Principles of Instructional Design.pptx
PPTX
Blending method and technology for hydrogen.pptx
PDF
The Digital Engine Room: Unlocking APAC’s Economic and Digital Potential thro...
PDF
FASHION-DRIVEN TEXTILES AS A CRYSTAL OF A NEW STREAM FOR STAKEHOLDER CAPITALI...
PDF
EGCB_Solar_Project_Presentation_and Finalcial Analysis.pdf
PPTX
Information-Technology-in-Human-Society (2).pptx
PDF
State of AI in Business 2025 - MIT NANDA
PDF
Technical Debt in the AI Coding Era - By Antonio Bianco
PPTX
Information-Technology-in-Human-Society.pptx
PDF
Domain-specific knowledge and context in large language models: challenges, c...
PPTX
Report in SIP_Distance_Learning_Technology_Impact.pptx
PDF
EIS-Webinar-Regulated-Industries-2025-08.pdf
PDF
TicketRoot: Event Tech Solutions Deck 2025
CEH Module 2 Footprinting CEH V13, concepts
“Introduction to Designing with AI Agents,” a Presentation from Amazon Web Se...
Human Computer Interaction Miterm Lesson
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
Altius execution marketplace concept.pdf
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
The AI Revolution in Customer Service - 2025
Presentation - Principles of Instructional Design.pptx
Blending method and technology for hydrogen.pptx
The Digital Engine Room: Unlocking APAC’s Economic and Digital Potential thro...
FASHION-DRIVEN TEXTILES AS A CRYSTAL OF A NEW STREAM FOR STAKEHOLDER CAPITALI...
EGCB_Solar_Project_Presentation_and Finalcial Analysis.pdf
Information-Technology-in-Human-Society (2).pptx
State of AI in Business 2025 - MIT NANDA
Technical Debt in the AI Coding Era - By Antonio Bianco
Information-Technology-in-Human-Society.pptx
Domain-specific knowledge and context in large language models: challenges, c...
Report in SIP_Distance_Learning_Technology_Impact.pptx
EIS-Webinar-Regulated-Industries-2025-08.pdf
TicketRoot: Event Tech Solutions Deck 2025

Microservice Automated Testing on Kubernetes