4. How We Test Traditionally
4
Build
Unit
Test
Deploy
CI/CD Pipeline
SCM
Dev/Test/Stage/Perf
MyApp
Data
Service A
Service C
Service B
App
AppOther
Apps
Dedicated
Testing Suite
(LoadRunner)
Problems:
▪ Environment stability
▪ Dependency availability
▪ Limited testing window
▪ Unreliable results
Client
Dedicated env with shared dependencies
Performance TestingFunctional Testing
Dependencies
5. Automated Virtualized Testing (AVT) Approach
5
Introducing AVT
AVT is an approach that leverages
Containers As A Service (CaaS)
infrastructure to auto-provision
ephemeral runtime environments with
external dependencies virtualized with
mocks, so your application can run and
be tested in a scalable and repeatable
fashion.
Benefits
▪ Reliable results and trending over time -
because we focus on app-under-test
rather than its dependencies and the
environment
▪ Cost saving - we no longer need to
maintain dedicated permanent test
environments that only see sporadic
usage
▪ Automated and repeatable - Increase
testing automation in CI/CD pipeline
Guiding
Principles
Reusable
Components
Integrated
Framework
• Test only what you control
• Avoid testing in shared
environments
• Treat infrastructure as code
• Docker images
• Docker compose files
• Kubernetes manifest files
• Shell scripts
• Monitoring/Visualization tools
• Project structure convention
• CI/CD pipeline integration
• CaaS provider integration
6. AVT Conceptual Architecture
6
Build
Unit
Test
Functional
Test
CI/CD Pipeline
SCM
Non-Prod/Prod
MyApp Data
Perf
Test
Deploy
Functional Testing Env
MyApp
Data
Mock Svc A
Mock Svc A
Mock Svc A
Test Driver
& Scripts
Perf Testing Env
MyApp
Data
Mock Svc A
Mock Svc A
Mock Svc A
Test Driver
& Scripts
CaaS Infrastructure
Auto-Provision
Mock Svc A
Mock Svc A
Service A
Artifact
Repo
Result
Aggregation &
Visualization
7. AVT Implementation @ Liberty Mutual
7
Build
Unit
Test
Functional
Test
CI/CD Pipeline Non-Prod/Prod
MyApp Data
Perf
Test
Deploy
Functional Testing Env
Mock Svc A
Mock Svc A
Perf Testing Env
Mock Svc A
Mock Svc A
Auto-Provision
Mock Svc A
Mock Svc A
Service A
App
Artifacts
Mock
Config
Test
Scripts
App Artifacts
Mock Config
Test Scripts
8. Demo - Sample Application and Tooling
8
Sample Application
• A Spring Boot application
• Expose Restful endpoints
• Read data from a MySQL database
• Call other web services
Tooling
• Java 11 and Maven 3.2.5
• InfluxDB 1.7
• Grafana 7.0.5
• Docker Desktop Community 2.3.0.3
• Kubernetes 1.16.5
• Kompose 1.21.0
9. Demo - Steps
9
Clone git repo (skipped)
Use kompose to convert docker-compose to
Kubernetes manifest files
Build Spring Boot executable jar
(skipped)
run-app-gatling-k8s.sh
kubectl apply -f k8s-app-gatling/
12. Lessons Learned
12
Having well-defined service contracts is important.
The adoption of the framework can be incremental depending on each
app’s unique situation to balance upfront costs vs. benefits over time.
Being able to launch test environments either from desktop or via
CI/CD pipeline is very powerful, especially during test development and
troubleshooting environment configurations.
Organizations adopting AVT should focus more on its core guiding
principles, keep the implementation flexible and adjust to your
organization’s existing infrastructure and practice.