SlideShare uma empresa Scribd logo
1 de 30
© 2021 IBM Corporation
Replicating production on
your laptop using the
magic of containers
Grace Jansen
Developer Advocate
@gracejansen27
Why do we write automated
tests?
To have confidence that our applications
work the way we want them to!
System/
UI testing
Integration testing
UnitTesting
Types of testing
ManualTesting if I have
time and remember
Integration
testing
UnitTesting
What we have
time to do
Problem with just using Unit tests
Tap turns on
Tap turns off
Drain works
Sink does not overflow
Testing with
Containers
The Magic of Containers
• Virtualization from OS level
• Lightweight
• Faster start-up
• Portable with images and config files such as a Dockerfile
• Run Anywhere
• Isolation
• Complexity!
The Magic of Kubernetes
• Automated rollouts and rollbacks
• Automatic scaling of services (containers)
• Health monitoring
• Declarative management
• Deploy anywhere (Hybrid deployments)
What Magic can Developers use?
• Isolated development environments
• Portable
• Preconfigured images available
• Fast start-up of applications
• No need to have so many pre-reqs installed
• Version control of dependencies
• Can develop easily in the cloud
• True-to production testing!
What Magic can Developers use?
• Isolated development environments
• Portable
• Preconfigured images available
• Fast start-up of applications
• No need to have so many pre-reqs installed
• Version control of dependencies
• Can develop easily in the cloud
• True-to production testing!
1. Codebase
2. Dependencies
3. Config
4. Backing Services
5. Build, Release, Run
6. Stateless Processes
7. Port Binding
8. Concurrency
9. Disposability
10. Dev-Prod Parity
11. Logs
12. Admin processes
Dev-Prod Parity
Keep development, staging, and production as similar as possible
Comprised of three common issues:
• The time gap
• The personnel gap
• The tools gap
“The twelve-factor developer resists the urge to use different backing services
between development and production, even when adapters theoretically
abstract away any differences in backing services.”
IT WORKS
ON MY
MACHINE
Testing Problems that Containers can solve
• Data access such access to databases
• Integration testing
• Automatic updating and version control
• Complex setup on local machines
• Portable testing environments (So others can run the
same test easily)
• …
Testcontainers
https://www.testcontainers.org/
my-
app:latest
(app container)
mongo:4.0
(DB container)
Dev/Test env
Production env
integration
tests
end users
my-
app:latest
(app container)
mongo:4.0
(DB container)
Testcontainers
• Integration tests that are easy
to setup, write, and run
• Test your apps the same way
they run in production
• Tests are portable to any
compatible implementation:
• Liberty
• Wildfly
• Payara
• TomEE
• etc…
AvailableTestcontainer Modules:
Database Modules:
• CouchBase
• DB2
• MongoDB
• MySQL
• Postgress etc
Other Modules:
• Docker Compose
• Elasticsearch
• Kafka
• Nginx
• RabbitMQ
MicroShed Testing
http://microshed.org/microshed-testing/
What is MicroShedTesting?
The MicroshedTesting framework allows for true-to-production
integration tests on your local machine.This enables you as a
developer to minimize the amount of test failures due to differences in
dev/test and production environments. Using the magic of containers,
you can replicate what you have in your production environment
without much setup at all.
MicroShed Example
@MicroShedTest
public class MyTest {
// Search for Dockerfile.
// Start app in Container.
// Wait for Container before running tests.
@Container
public static MicroProfileApplication app
= new MicroProfileApplication()
.withAppContextRoot("/myservice");
// Inject JAX-RS REST Client
@RestClient
public static MyService mySvc;
// A test method like any other
@Test
public void testMyService() {
...
}
}
The @MicroShedTest annotation is required so
that the build knows this is a MicroShed test
The @Container annotation is required for setting
up your container to run your tests inside
The @RESTClient annotation is needed to give us
something to test against
The @Test annotation like you would in a normal
JUnit test.
SharableConfiguration
If multiple test classes can share the same container instances, they
can offload their @Container annotated fields to a sperate class like
so:
public class AppContainerConfig implements SharedContainerConfiguration {
@Container
public static ApplicationContainer app = new ApplicationContainer()
.withAppContextRoot("/myservice");
}
@MicroShedTest
@SharedContainerConfig(AppContainerConfig.class)
public class MySimpleTestA {
// ...
}
@MicroShedTest
@SharedContainerConfig(AppContainerConfig.class)
public class MySimpleTestB {
// ...
}
Different RuntimesAvailable
• Open Liberty
• Payara Micro
• Payara Sever
• Wildfly
• Quarkus
True to production
testing with MicroShed
Testing
Skills Network Labs
Skills Network Labs
Interactive Demo
Turning a JUnit test into a MicroShed test
If you would like to follow along at the same time please go to the
following link and select the “Testing a MicroProfile or Jakarta EE
Application” Module
https://openliberty.skillsnetwork.site/cloud-native-java-made-
easy-microprofile-jakarta-ee
Summary
• Containers are great!
• They make developers lives easier (portable, configurable,
lightweight…)
• They can help solve some issues with testing such as dev/test prod
parity
• There are some great open source tools available to utilise testing
with containers
• Helps speed up time to production, making everyone happier!
Resources:
• Run true-to-production tests on your MicroProfile and JakartaEE applications -
https://developer.ibm.com/languages/java/articles/true-to-production-testing-
microprofile-jakarta-ee/
• Five Java frameworks for improving your automated testing -
https://developer.ibm.com/devpractices/continuous-delivery/blogs/five-frameworks-for-
improving-your-java-automated-tests/
• Open Liberty - https://openliberty.io
• MicroShed - https://microshed.org
• Testcontainers - https://www.testcontainers.org/
• MicroProfile - https://microprofile.io/
• Jakarta EE - https://jakarta.ee/
ThankYou
Grace Jansen
@gracejansen27

Mais conteúdo relacionado

Mais procurados

Setup API Introductie
Setup API IntroductieSetup API Introductie
Setup API Introductie
annehelmond
 
Geo Enabling Enterprises - Powered by Rolta i Perspective and the WSO2 ESB
Geo Enabling Enterprises - Powered by Rolta i Perspective and the WSO2 ESBGeo Enabling Enterprises - Powered by Rolta i Perspective and the WSO2 ESB
Geo Enabling Enterprises - Powered by Rolta i Perspective and the WSO2 ESB
WSO2
 
Era of APIs: Why do we need an API strategy?
Era of APIs: Why do we need an API strategy?Era of APIs: Why do we need an API strategy?
Era of APIs: Why do we need an API strategy?
Bala Iyer
 

Mais procurados (20)

Setup API Introductie
Setup API IntroductieSetup API Introductie
Setup API Introductie
 
apidays LIVE Australia 2021 - Tracing across your distributed process boundar...
apidays LIVE Australia 2021 - Tracing across your distributed process boundar...apidays LIVE Australia 2021 - Tracing across your distributed process boundar...
apidays LIVE Australia 2021 - Tracing across your distributed process boundar...
 
apidays LIVE Singapore - Using data to track plastic waste and recovery globa...
apidays LIVE Singapore - Using data to track plastic waste and recovery globa...apidays LIVE Singapore - Using data to track plastic waste and recovery globa...
apidays LIVE Singapore - Using data to track plastic waste and recovery globa...
 
API-led connectivity: How to leverage reusable microservices
 API-led connectivity: How to leverage reusable microservices API-led connectivity: How to leverage reusable microservices
API-led connectivity: How to leverage reusable microservices
 
Geo Enabling Enterprises - Powered by Rolta i Perspective and the WSO2 ESB
Geo Enabling Enterprises - Powered by Rolta i Perspective and the WSO2 ESBGeo Enabling Enterprises - Powered by Rolta i Perspective and the WSO2 ESB
Geo Enabling Enterprises - Powered by Rolta i Perspective and the WSO2 ESB
 
State of enterprise mobile app development 2017
State of enterprise mobile app development 2017State of enterprise mobile app development 2017
State of enterprise mobile app development 2017
 
IntegrationWorks: Grow Your Business with the API Economy
IntegrationWorks: Grow Your Business with the API EconomyIntegrationWorks: Grow Your Business with the API Economy
IntegrationWorks: Grow Your Business with the API Economy
 
Infopulse AI, Data Science & RPA Managed Services
Infopulse AI, Data Science & RPA Managed ServicesInfopulse AI, Data Science & RPA Managed Services
Infopulse AI, Data Science & RPA Managed Services
 
Pragmatic approach to Microservice Architecture: Role of Middleware
Pragmatic approach to Microservice Architecture: Role of MiddlewarePragmatic approach to Microservice Architecture: Role of Middleware
Pragmatic approach to Microservice Architecture: Role of Middleware
 
AI ML by Silver Touch Tech Lab
AI ML by Silver Touch Tech LabAI ML by Silver Touch Tech Lab
AI ML by Silver Touch Tech Lab
 
Adopting the Right Architecture for IoT Implementation
Adopting the Right Architecture for IoT ImplementationAdopting the Right Architecture for IoT Implementation
Adopting the Right Architecture for IoT Implementation
 
Red Hat Mobile
Red Hat MobileRed Hat Mobile
Red Hat Mobile
 
apidays LIVE LONDON - Evolving API Management for Event-Driven Digital Bankin...
apidays LIVE LONDON - Evolving API Management for Event-Driven Digital Bankin...apidays LIVE LONDON - Evolving API Management for Event-Driven Digital Bankin...
apidays LIVE LONDON - Evolving API Management for Event-Driven Digital Bankin...
 
apidays LIVE New York 2021 - 5 Pragmatic steps to unlock Open Finance with AP...
apidays LIVE New York 2021 - 5 Pragmatic steps to unlock Open Finance with AP...apidays LIVE New York 2021 - 5 Pragmatic steps to unlock Open Finance with AP...
apidays LIVE New York 2021 - 5 Pragmatic steps to unlock Open Finance with AP...
 
Digital Transformation in a World of Connected Devices
Digital Transformation in a World of Connected DevicesDigital Transformation in a World of Connected Devices
Digital Transformation in a World of Connected Devices
 
[2021 Somos Summit] - Rethinking Identity Access Management and The Rise of t...
[2021 Somos Summit] - Rethinking Identity Access Management and The Rise of t...[2021 Somos Summit] - Rethinking Identity Access Management and The Rise of t...
[2021 Somos Summit] - Rethinking Identity Access Management and The Rise of t...
 
The Role of AI and Automation
The Role of AI and Automation The Role of AI and Automation
The Role of AI and Automation
 
Era of APIs: Why do we need an API strategy?
Era of APIs: Why do we need an API strategy?Era of APIs: Why do we need an API strategy?
Era of APIs: Why do we need an API strategy?
 
apidays LIVE Australia 2021 - How API’s are securing sensitive customer data ...
apidays LIVE Australia 2021 - How API’s are securing sensitive customer data ...apidays LIVE Australia 2021 - How API’s are securing sensitive customer data ...
apidays LIVE Australia 2021 - How API’s are securing sensitive customer data ...
 
Mendix-7-Keynote
Mendix-7-KeynoteMendix-7-Keynote
Mendix-7-Keynote
 

Semelhante a JBCN_Testing_With_Containers

Semelhante a JBCN_Testing_With_Containers (20)

JLove - Replicating production on your laptop using the magic of containers
JLove - Replicating production on your laptop using the magic of containersJLove - Replicating production on your laptop using the magic of containers
JLove - Replicating production on your laptop using the magic of containers
 
Cloud Native Dünyada CI/CD
Cloud Native Dünyada CI/CDCloud Native Dünyada CI/CD
Cloud Native Dünyada CI/CD
 
Prod-Like Integration Testing for Distributed Containerized Applications
Prod-Like Integration Testing for Distributed Containerized ApplicationsProd-Like Integration Testing for Distributed Containerized Applications
Prod-Like Integration Testing for Distributed Containerized Applications
 
DevOps with Elastic Beanstalk - TCCC-2014
DevOps with Elastic Beanstalk - TCCC-2014DevOps with Elastic Beanstalk - TCCC-2014
DevOps with Elastic Beanstalk - TCCC-2014
 
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
 
A curtain-raiser to the container world Docker & Kubernetes
A curtain-raiser to the container world Docker & KubernetesA curtain-raiser to the container world Docker & Kubernetes
A curtain-raiser to the container world Docker & Kubernetes
 
Level Up Your Integration Testing With Testcontainers
Level Up Your Integration Testing With TestcontainersLevel Up Your Integration Testing With Testcontainers
Level Up Your Integration Testing With Testcontainers
 
Devops
DevopsDevops
Devops
 
Containers: DevOp Enablers of Technical Solutions
Containers: DevOp Enablers of Technical SolutionsContainers: DevOp Enablers of Technical Solutions
Containers: DevOp Enablers of Technical Solutions
 
Efficient Parallel Testing with Docker
Efficient Parallel Testing with DockerEfficient Parallel Testing with Docker
Efficient Parallel Testing with Docker
 
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
04_Azure Kubernetes Service: Basic Practices for Developers_GAB201904_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
 
DEVNET-1169 CI/CT/CD on a Micro Services Applications using Docker, Salt & Ni...
DEVNET-1169	CI/CT/CD on a Micro Services Applications using Docker, Salt & Ni...DEVNET-1169	CI/CT/CD on a Micro Services Applications using Docker, Salt & Ni...
DEVNET-1169 CI/CT/CD on a Micro Services Applications using Docker, Salt & Ni...
 
What is Docker?
What is Docker?What is Docker?
What is Docker?
 
Docker - A curtain raiser to the Container world
Docker - A curtain raiser to the Container worldDocker - A curtain raiser to the Container world
Docker - A curtain raiser to the Container world
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
 
Role of Containerization in Automation Testing
Role of Containerization in Automation TestingRole of Containerization in Automation Testing
Role of Containerization in Automation Testing
 
Containerized application
Containerized applicationContainerized application
Containerized application
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
 

Mais de Grace Jansen

Mais de Grace Jansen (20)

JPrime_JITServer.pptx
JPrime_JITServer.pptxJPrime_JITServer.pptx
JPrime_JITServer.pptx
 
SwissJUG_15_factor_app.pptx
SwissJUG_15_factor_app.pptxSwissJUG_15_factor_app.pptx
SwissJUG_15_factor_app.pptx
 
SwissJUG_Bringing the cloud back down to earth.pptx
SwissJUG_Bringing the cloud back down to earth.pptxSwissJUG_Bringing the cloud back down to earth.pptx
SwissJUG_Bringing the cloud back down to earth.pptx
 
ThroughTheLookingGlass_EffectiveObservability.pptx
ThroughTheLookingGlass_EffectiveObservability.pptxThroughTheLookingGlass_EffectiveObservability.pptx
ThroughTheLookingGlass_EffectiveObservability.pptx
 
PittsburgJUG_Cloud-Native Dev Tools: Bringing the cloud back to earth
PittsburgJUG_Cloud-Native Dev Tools: Bringing the cloud back to earthPittsburgJUG_Cloud-Native Dev Tools: Bringing the cloud back to earth
PittsburgJUG_Cloud-Native Dev Tools: Bringing the cloud back to earth
 
Javaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptxJavaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptx
 
JavaLand_To InstantOn and Beyond.pptx
JavaLand_To InstantOn and Beyond.pptxJavaLand_To InstantOn and Beyond.pptx
JavaLand_To InstantOn and Beyond.pptx
 
Jfokus_Bringing the cloud back down to earth.pptx
Jfokus_Bringing the cloud back down to earth.pptxJfokus_Bringing the cloud back down to earth.pptx
Jfokus_Bringing the cloud back down to earth.pptx
 
FooConf23_Bringing the cloud back down to earth.pptx
FooConf23_Bringing the cloud back down to earth.pptxFooConf23_Bringing the cloud back down to earth.pptx
FooConf23_Bringing the cloud back down to earth.pptx
 
DevoxxBelgium_StatefulCloud.pptx
DevoxxBelgium_StatefulCloud.pptxDevoxxBelgium_StatefulCloud.pptx
DevoxxBelgium_StatefulCloud.pptx
 
UtrechtJUG_Exploring statefulmicroservices in a cloud-native world.pptx
UtrechtJUG_Exploring statefulmicroservices in a cloud-native world.pptxUtrechtJUG_Exploring statefulmicroservices in a cloud-native world.pptx
UtrechtJUG_Exploring statefulmicroservices in a cloud-native world.pptx
 
JCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptxJCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptx
 
JCON_Adressing the transaction challenge in a cloud-native world.pptx
JCON_Adressing the transaction challenge in a cloud-native world.pptxJCON_Adressing the transaction challenge in a cloud-native world.pptx
JCON_Adressing the transaction challenge in a cloud-native world.pptx
 
JavaZone_Addressing the transaction challenge in a cloud-native world.pptx
JavaZone_Addressing the transaction challenge in a cloud-native world.pptxJavaZone_Addressing the transaction challenge in a cloud-native world.pptx
JavaZone_Addressing the transaction challenge in a cloud-native world.pptx
 
JavaZone_Mother Nature vs Java – the security face off.pptx
JavaZone_Mother Nature vs Java – the security face off.pptxJavaZone_Mother Nature vs Java – the security face off.pptx
JavaZone_Mother Nature vs Java – the security face off.pptx
 
Boost developer productivity with EE, MP and OL (Devoxx Ukraine 22).pptx
Boost developer productivity with EE, MP and OL (Devoxx Ukraine 22).pptxBoost developer productivity with EE, MP and OL (Devoxx Ukraine 22).pptx
Boost developer productivity with EE, MP and OL (Devoxx Ukraine 22).pptx
 
Addressing the transaction challenge in a cloud-native world Devoxx Ukraine 2022
Addressing the transaction challenge in a cloud-native world Devoxx Ukraine 2022Addressing the transaction challenge in a cloud-native world Devoxx Ukraine 2022
Addressing the transaction challenge in a cloud-native world Devoxx Ukraine 2022
 
JBCNConf_Addressing_The_Transaction_Challenge_LRA.pptx
JBCNConf_Addressing_The_Transaction_Challenge_LRA.pptxJBCNConf_Addressing_The_Transaction_Challenge_LRA.pptx
JBCNConf_Addressing_The_Transaction_Challenge_LRA.pptx
 
2022-Devnexus-StatefulMicroservices.pptx.pdf
2022-Devnexus-StatefulMicroservices.pptx.pdf2022-Devnexus-StatefulMicroservices.pptx.pdf
2022-Devnexus-StatefulMicroservices.pptx.pdf
 
How to become a superhero without even leaving your desk!
How to become a superhero without even leaving your desk!How to become a superhero without even leaving your desk!
How to become a superhero without even leaving your desk!
 

Último

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Último (20)

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 

JBCN_Testing_With_Containers

  • 1. © 2021 IBM Corporation Replicating production on your laptop using the magic of containers Grace Jansen Developer Advocate @gracejansen27
  • 2. Why do we write automated tests?
  • 3. To have confidence that our applications work the way we want them to!
  • 5. ManualTesting if I have time and remember Integration testing UnitTesting What we have time to do
  • 6. Problem with just using Unit tests Tap turns on Tap turns off Drain works Sink does not overflow
  • 8. The Magic of Containers • Virtualization from OS level • Lightweight • Faster start-up • Portable with images and config files such as a Dockerfile • Run Anywhere • Isolation • Complexity!
  • 9. The Magic of Kubernetes • Automated rollouts and rollbacks • Automatic scaling of services (containers) • Health monitoring • Declarative management • Deploy anywhere (Hybrid deployments)
  • 10. What Magic can Developers use? • Isolated development environments • Portable • Preconfigured images available • Fast start-up of applications • No need to have so many pre-reqs installed • Version control of dependencies • Can develop easily in the cloud • True-to production testing!
  • 11. What Magic can Developers use? • Isolated development environments • Portable • Preconfigured images available • Fast start-up of applications • No need to have so many pre-reqs installed • Version control of dependencies • Can develop easily in the cloud • True-to production testing!
  • 12. 1. Codebase 2. Dependencies 3. Config 4. Backing Services 5. Build, Release, Run 6. Stateless Processes 7. Port Binding 8. Concurrency 9. Disposability 10. Dev-Prod Parity 11. Logs 12. Admin processes
  • 13. Dev-Prod Parity Keep development, staging, and production as similar as possible Comprised of three common issues: • The time gap • The personnel gap • The tools gap “The twelve-factor developer resists the urge to use different backing services between development and production, even when adapters theoretically abstract away any differences in backing services.”
  • 15. Testing Problems that Containers can solve • Data access such access to databases • Integration testing • Automatic updating and version control • Complex setup on local machines • Portable testing environments (So others can run the same test easily) • …
  • 17. my- app:latest (app container) mongo:4.0 (DB container) Dev/Test env Production env integration tests end users my- app:latest (app container) mongo:4.0 (DB container) Testcontainers • Integration tests that are easy to setup, write, and run • Test your apps the same way they run in production • Tests are portable to any compatible implementation: • Liberty • Wildfly • Payara • TomEE • etc…
  • 18. AvailableTestcontainer Modules: Database Modules: • CouchBase • DB2 • MongoDB • MySQL • Postgress etc Other Modules: • Docker Compose • Elasticsearch • Kafka • Nginx • RabbitMQ
  • 20. What is MicroShedTesting? The MicroshedTesting framework allows for true-to-production integration tests on your local machine.This enables you as a developer to minimize the amount of test failures due to differences in dev/test and production environments. Using the magic of containers, you can replicate what you have in your production environment without much setup at all.
  • 21. MicroShed Example @MicroShedTest public class MyTest { // Search for Dockerfile. // Start app in Container. // Wait for Container before running tests. @Container public static MicroProfileApplication app = new MicroProfileApplication() .withAppContextRoot("/myservice"); // Inject JAX-RS REST Client @RestClient public static MyService mySvc; // A test method like any other @Test public void testMyService() { ... } } The @MicroShedTest annotation is required so that the build knows this is a MicroShed test The @Container annotation is required for setting up your container to run your tests inside The @RESTClient annotation is needed to give us something to test against The @Test annotation like you would in a normal JUnit test.
  • 22. SharableConfiguration If multiple test classes can share the same container instances, they can offload their @Container annotated fields to a sperate class like so: public class AppContainerConfig implements SharedContainerConfiguration { @Container public static ApplicationContainer app = new ApplicationContainer() .withAppContextRoot("/myservice"); } @MicroShedTest @SharedContainerConfig(AppContainerConfig.class) public class MySimpleTestA { // ... } @MicroShedTest @SharedContainerConfig(AppContainerConfig.class) public class MySimpleTestB { // ... }
  • 23. Different RuntimesAvailable • Open Liberty • Payara Micro • Payara Sever • Wildfly • Quarkus
  • 24. True to production testing with MicroShed Testing
  • 27. Interactive Demo Turning a JUnit test into a MicroShed test If you would like to follow along at the same time please go to the following link and select the “Testing a MicroProfile or Jakarta EE Application” Module https://openliberty.skillsnetwork.site/cloud-native-java-made- easy-microprofile-jakarta-ee
  • 28. Summary • Containers are great! • They make developers lives easier (portable, configurable, lightweight…) • They can help solve some issues with testing such as dev/test prod parity • There are some great open source tools available to utilise testing with containers • Helps speed up time to production, making everyone happier!
  • 29. Resources: • Run true-to-production tests on your MicroProfile and JakartaEE applications - https://developer.ibm.com/languages/java/articles/true-to-production-testing- microprofile-jakarta-ee/ • Five Java frameworks for improving your automated testing - https://developer.ibm.com/devpractices/continuous-delivery/blogs/five-frameworks-for- improving-your-java-automated-tests/ • Open Liberty - https://openliberty.io • MicroShed - https://microshed.org • Testcontainers - https://www.testcontainers.org/ • MicroProfile - https://microprofile.io/ • Jakarta EE - https://jakarta.ee/