SlideShare a Scribd company logo
Automated Testing in
a World of Interdependence:
Service Virtualisation for the Modern Age
TestWorksConf Workshop, 7th October
Benji Hooper, Daniel Bryant, John Davenport, Tom Cunliffe
About Specto Workshops
• This slide deck is an excerpt from a workshop delivered as part of the
test automation TestWorksConf
• http://testworksconf.com/talk/automated-testing-in-a-world-of-interdependence
• The Specto team run public and private workshops (contact@specto.io)
• All aspects of test automation
• Microservice testing and service virtualisation with Hoverfly
• Incorporating FR / NFR testing into a build pipeline
Testing is kind of important.
Knight Capital, 2012
$440m loss
Neiman Marcus, Black Friday 2015
IPO cancelled
Stock trading disruption
12 hour outage
Royal Bank of Scotland, 2012
Transactions disrupted worldwide
£500m in fines and
compensation
OK - very important.
In any complex distributed system…
… testing an individual
component in isolation
is difficult….
… and test automation is
sometimes impossible
Agenda
• Group flip-chart sessions (30 minutes)
• Introduction to service virtualization (20 minutes)
• Hands-on session (50 minutes)
• Wrap up
Group flip-chart session
• Equal-sized groups:
• 1 facilitator - Edze, Tom, Daniel, Benji and John
• 1 scribe
• 1 presenter
• 30 minutes
• 10-15 minutes: read the scenario & discuss issues
• 4 presentations of 4 minutes - your main issues and solutions
The busy QA / developer’s guide to
service virtualisation
credit to @mogronalol 10
Resources
shopfront
stockmanager
productcatalogue
Payments
Fraud
Cost
credit to @mogronalol 11
credit to @mogronalol 12
Licensing
Consumer
Producer
Consumer
Producer
Third party Cost
credit to @mogronalol 13
Dependency Constraints
Consumer
Producer
Consumer
Producer
credit to @mogronalol 14
Flakey Dependencies
Consumer
Producer
Consumer
Producer
credit to @mogronalol 15
Doesn't exist
Consumer
?
credit to @mogronalol 16
Non Deterministic
assertThat(booking.getDate())
.isEqualTo(LocalDate.of(2013,1,8));
Consumer
Booking
Service
Consumer
Booking
Service
Consumer
Booking
Service {
“date” : “2013-01-08”,
…
}
{
“date” : “2016-02-07”,
…
}
credit to @mogronalol 17
Fault Injection
Consumer
Producer
Consumer
Producer
4xx, 5xx, timeouts
Operationally
challenging to trigger
faults
credit to @mogronalol 18
Service Virtualisation
• Emulation of real service
• Non-intrusive
• Lightweight - or should be
credit to @mogronalol 19
Service Virtualisation
Consumer Producer
Virtual
Producer
credit to @mogronalol 20
Creating Data
Consumer Producer
Service
Virtualisation
Tool
credit to @mogronalol 21
Creating Data
https://github.com/tomakehurst/wiremock
credit to @mogronalol 22
Proxy Mode
Consumer Producer
Service
Virtualisation
Tool
credit to @mogronalol 23
Webserver / Facade Mode
Consumer Producer
Service
Virtualisation
Tool
credit to @mogronalol 24
Not Mocking
Service Under Test
Mocking
Dependant Service
Http
Virtual Service
Mocks bleed into the
architectural boundary of
your application
credit to @mogronalol 25
Open Source Tooling
credit to @mogronalol 26
Record and replay
Consumer
External
Producer
Service
Virtualisati
on Tool
credit to @mogronalol 27
JUnit Example
@Rule
public HoverflyRule hoverflyRule = HoverflyRule.inCaptureMode(“src/test/
resources/external.json").build();
@Test

public void shouldBeAbleToRetrieveABooking() throws URISyntaxException {

// Given

final int bookingId = 1;



// When

final Booking booking = bookingServiceGateway.getBooking(bookingId);



// Then

assertThat(booking.getCustomer()).isEqualTo(“Andrew Morgan”);
assertThat(booking.getDate()).isEqualTo(LocalDate.of(2016,3,1));

}
credit to @mogronalol 28
JUnit Example
{

"data": [

{

"request": {

"path": "/api/bookings/1",

"method": "GET",

"destination": "www.my-test.com",

"query": null,

"body": ""

},

"response": {

"status": 200,

"body": “{”customer”:”Andrew Morgan", ”date”:
”2016-03-01”}}}”,

"headers": {

"Content-Type": [

"application/json"

]

}

}

}

]

}
credit to @mogronalol 29
JUnit Example
@Test

public void shouldBeAbleToRetrieveABooking() throws URISyntaxException {

// Given

final int bookingId = 1;



// When

final Booking booking = bookingServiceGateway.getBooking(bookingId);



// Then

assertThat(booking.getCustomer()).isEqualTo(“Andrew Morgan”);
assertThat(booking.getDate()).isEqualTo(LocalDate.of(2016,3,1));

}
@Rule
public HoverflyRule hoverflyRule =
HoverflyRule.buildFromClassPathResource(“external.json").build();
credit to @mogronalol 30
Advantages
• Isolation
• Flaky dependencies
• Rate limiting
• Deterministic
• Licensing
credit to @mogronalol 31
Deployment and Infrastructure
Consumer
External
Producer
Virtual
Service
Internal
Producer
Internal
Producer
Internal
Producer
Virtual
Service
Virtual
Service
Virtual
Service
credit to @mogronalol 32
CLI Example
$ hoverctl start —proxy-port 8080
$ hoverctl import accounts-service-simulation.json
$ hoverctl start —proxy-port 8081
$ hoverctl import payments-service-simulation.json
$ curl http://www.account-service.com/api/v1/accounts/1 —proxy http://
localhost:8080
[{"name":"foo"}]
$ curl http://www.payment-service.com/api/v1/payments/1 -proxy http://
localhost:8081
[{“amount":"£23.27"}]
Hands-on session
• Exercise 1: Explore an application that needs testing
and create the simulations required to test it
independently
• Exercise 2: Test the circuit breakers in an application
using Hoverfly
• Code available:
• https://github.com/benjih/oreilly-docker-java-shopping
• Edze, Tom, Daniel, Benji and John will be around for
help if needed (and feel free to work with others!)
Let’s wrap this up…
If you create simulations of components…
… then individual components can be
tested in isolation.
A simulation of a component behaves
like the real thing…
… it misbehaves like the real thing…
So you can create a realistic, repeatable
test environment…
… and automate all the things.
github.com/SpectoLabs/hoverfly
specto.io/blog
We run public and private training workshops:
contact@specto.io

More Related Content

Similar to SpectoLabs Xebia TestWorks Conf October 2016

Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
Andrew Morgan
 
deliver:Agile 2019 "Testing Microservices: From Development to Production
deliver:Agile 2019 "Testing Microservices: From Development to Productiondeliver:Agile 2019 "Testing Microservices: From Development to Production
deliver:Agile 2019 "Testing Microservices: From Development to Production
Daniel Bryant
 
Continuous Performance Testing
Continuous Performance TestingContinuous Performance Testing
Continuous Performance Testing
C4Media
 
IoT Guildford Meetup#27: EU H2020 F-Interop project open call
IoT Guildford Meetup#27: EU H2020 F-Interop project open callIoT Guildford Meetup#27: EU H2020 F-Interop project open call
IoT Guildford Meetup#27: EU H2020 F-Interop project open call
MicheleNati
 
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발 [Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
Yunho Maeng
 
Testing Applications—For the Cloud and in the Cloud
Testing Applications—For the Cloud and in the CloudTesting Applications—For the Cloud and in the Cloud
Testing Applications—For the Cloud and in the Cloud
TechWell
 
Vertical Slicing Architectures
Vertical Slicing ArchitecturesVertical Slicing Architectures
Vertical Slicing Architectures
Victor Rentea
 
TechTalk: Get to Know Perfecto
TechTalk: Get to Know Perfecto TechTalk: Get to Know Perfecto
TechTalk: Get to Know Perfecto
Lizzy Guido (she/her)
 
'Test Automation in the Cloud' with Jonathon Wright
'Test Automation in the Cloud' with Jonathon Wright'Test Automation in the Cloud' with Jonathon Wright
'Test Automation in the Cloud' with Jonathon Wright
TEST Huddle
 
Stateful mock servers to the rescue on REST ecosystems
Stateful mock servers to the rescue on REST ecosystemsStateful mock servers to the rescue on REST ecosystems
Stateful mock servers to the rescue on REST ecosystems
Nuno Caneco
 
How to build rock solid apps & keep 100m+ users happy
How to build rock solid apps & keep 100m+ users happyHow to build rock solid apps & keep 100m+ users happy
How to build rock solid apps & keep 100m+ users happy
Iordanis (Jordan) Giannakakis
 
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
Daniel Bryant
 
Microservices in AUTO1 by Alexander Egurtsov
Microservices in AUTO1 by Alexander EgurtsovMicroservices in AUTO1 by Alexander Egurtsov
Microservices in AUTO1 by Alexander Egurtsov
The Business Transformation Network
 
Testing strategies in microservices
Testing strategies in microservicesTesting strategies in microservices
Testing strategies in microservices
GeekNightHyderabad
 
Manoj kolhe - Continuous Integration Testing
Manoj kolhe - Continuous Integration TestingManoj kolhe - Continuous Integration Testing
Manoj kolhe - Continuous Integration Testing
Manoj Kolhe
 
Accelerate Agile Development with Service Virtualization - Czech Test
Accelerate Agile Development with Service Virtualization - Czech TestAccelerate Agile Development with Service Virtualization - Czech Test
Accelerate Agile Development with Service Virtualization - Czech Test
Parasoft
 
Dynatrace - Red Hat workshop : Monolith to Microservices
Dynatrace - Red Hat workshop : Monolith to MicroservicesDynatrace - Red Hat workshop : Monolith to Microservices
Dynatrace - Red Hat workshop : Monolith to Microservices
Steve Caron
 
Tools. Techniques. Trouble?
Tools. Techniques. Trouble?Tools. Techniques. Trouble?
Tools. Techniques. Trouble?
Testplant
 
OpenStack Sydney summit - OpenStack HA and Testing
OpenStack Sydney summit - OpenStack HA and TestingOpenStack Sydney summit - OpenStack HA and Testing
OpenStack Sydney summit - OpenStack HA and Testing
Sampath Priyankara
 
VMworld 2013: Automating the Software Defined Data Center: How Do I Get Started
VMworld 2013: Automating the Software Defined Data Center: How Do I Get Started VMworld 2013: Automating the Software Defined Data Center: How Do I Get Started
VMworld 2013: Automating the Software Defined Data Center: How Do I Get Started
VMworld
 

Similar to SpectoLabs Xebia TestWorks Conf October 2016 (20)

Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
 
deliver:Agile 2019 "Testing Microservices: From Development to Production
deliver:Agile 2019 "Testing Microservices: From Development to Productiondeliver:Agile 2019 "Testing Microservices: From Development to Production
deliver:Agile 2019 "Testing Microservices: From Development to Production
 
Continuous Performance Testing
Continuous Performance TestingContinuous Performance Testing
Continuous Performance Testing
 
IoT Guildford Meetup#27: EU H2020 F-Interop project open call
IoT Guildford Meetup#27: EU H2020 F-Interop project open callIoT Guildford Meetup#27: EU H2020 F-Interop project open call
IoT Guildford Meetup#27: EU H2020 F-Interop project open call
 
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발 [Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
 
Testing Applications—For the Cloud and in the Cloud
Testing Applications—For the Cloud and in the CloudTesting Applications—For the Cloud and in the Cloud
Testing Applications—For the Cloud and in the Cloud
 
Vertical Slicing Architectures
Vertical Slicing ArchitecturesVertical Slicing Architectures
Vertical Slicing Architectures
 
TechTalk: Get to Know Perfecto
TechTalk: Get to Know Perfecto TechTalk: Get to Know Perfecto
TechTalk: Get to Know Perfecto
 
'Test Automation in the Cloud' with Jonathon Wright
'Test Automation in the Cloud' with Jonathon Wright'Test Automation in the Cloud' with Jonathon Wright
'Test Automation in the Cloud' with Jonathon Wright
 
Stateful mock servers to the rescue on REST ecosystems
Stateful mock servers to the rescue on REST ecosystemsStateful mock servers to the rescue on REST ecosystems
Stateful mock servers to the rescue on REST ecosystems
 
How to build rock solid apps & keep 100m+ users happy
How to build rock solid apps & keep 100m+ users happyHow to build rock solid apps & keep 100m+ users happy
How to build rock solid apps & keep 100m+ users happy
 
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
 
Microservices in AUTO1 by Alexander Egurtsov
Microservices in AUTO1 by Alexander EgurtsovMicroservices in AUTO1 by Alexander Egurtsov
Microservices in AUTO1 by Alexander Egurtsov
 
Testing strategies in microservices
Testing strategies in microservicesTesting strategies in microservices
Testing strategies in microservices
 
Manoj kolhe - Continuous Integration Testing
Manoj kolhe - Continuous Integration TestingManoj kolhe - Continuous Integration Testing
Manoj kolhe - Continuous Integration Testing
 
Accelerate Agile Development with Service Virtualization - Czech Test
Accelerate Agile Development with Service Virtualization - Czech TestAccelerate Agile Development with Service Virtualization - Czech Test
Accelerate Agile Development with Service Virtualization - Czech Test
 
Dynatrace - Red Hat workshop : Monolith to Microservices
Dynatrace - Red Hat workshop : Monolith to MicroservicesDynatrace - Red Hat workshop : Monolith to Microservices
Dynatrace - Red Hat workshop : Monolith to Microservices
 
Tools. Techniques. Trouble?
Tools. Techniques. Trouble?Tools. Techniques. Trouble?
Tools. Techniques. Trouble?
 
OpenStack Sydney summit - OpenStack HA and Testing
OpenStack Sydney summit - OpenStack HA and TestingOpenStack Sydney summit - OpenStack HA and Testing
OpenStack Sydney summit - OpenStack HA and Testing
 
VMworld 2013: Automating the Software Defined Data Center: How Do I Get Started
VMworld 2013: Automating the Software Defined Data Center: How Do I Get Started VMworld 2013: Automating the Software Defined Data Center: How Do I Get Started
VMworld 2013: Automating the Software Defined Data Center: How Do I Get Started
 

Recently uploaded

Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
vrstrong314
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 

Recently uploaded (20)

Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 

SpectoLabs Xebia TestWorks Conf October 2016

  • 1. Automated Testing in a World of Interdependence: Service Virtualisation for the Modern Age TestWorksConf Workshop, 7th October Benji Hooper, Daniel Bryant, John Davenport, Tom Cunliffe
  • 2. About Specto Workshops • This slide deck is an excerpt from a workshop delivered as part of the test automation TestWorksConf • http://testworksconf.com/talk/automated-testing-in-a-world-of-interdependence • The Specto team run public and private workshops (contact@specto.io) • All aspects of test automation • Microservice testing and service virtualisation with Hoverfly • Incorporating FR / NFR testing into a build pipeline
  • 3. Testing is kind of important.
  • 4. Knight Capital, 2012 $440m loss Neiman Marcus, Black Friday 2015 IPO cancelled Stock trading disruption 12 hour outage Royal Bank of Scotland, 2012 Transactions disrupted worldwide £500m in fines and compensation
  • 5. OK - very important.
  • 6. In any complex distributed system… … testing an individual component in isolation is difficult…. … and test automation is sometimes impossible
  • 7. Agenda • Group flip-chart sessions (30 minutes) • Introduction to service virtualization (20 minutes) • Hands-on session (50 minutes) • Wrap up
  • 8. Group flip-chart session • Equal-sized groups: • 1 facilitator - Edze, Tom, Daniel, Benji and John • 1 scribe • 1 presenter • 30 minutes • 10-15 minutes: read the scenario & discuss issues • 4 presentations of 4 minutes - your main issues and solutions
  • 9. The busy QA / developer’s guide to service virtualisation
  • 10. credit to @mogronalol 10 Resources shopfront stockmanager productcatalogue Payments Fraud Cost
  • 12. credit to @mogronalol 12 Licensing Consumer Producer Consumer Producer Third party Cost
  • 13. credit to @mogronalol 13 Dependency Constraints Consumer Producer Consumer Producer
  • 14. credit to @mogronalol 14 Flakey Dependencies Consumer Producer Consumer Producer
  • 15. credit to @mogronalol 15 Doesn't exist Consumer ?
  • 16. credit to @mogronalol 16 Non Deterministic assertThat(booking.getDate()) .isEqualTo(LocalDate.of(2013,1,8)); Consumer Booking Service Consumer Booking Service Consumer Booking Service { “date” : “2013-01-08”, … } { “date” : “2016-02-07”, … }
  • 17. credit to @mogronalol 17 Fault Injection Consumer Producer Consumer Producer 4xx, 5xx, timeouts Operationally challenging to trigger faults
  • 18. credit to @mogronalol 18 Service Virtualisation • Emulation of real service • Non-intrusive • Lightweight - or should be
  • 19. credit to @mogronalol 19 Service Virtualisation Consumer Producer Virtual Producer
  • 20. credit to @mogronalol 20 Creating Data Consumer Producer Service Virtualisation Tool
  • 21. credit to @mogronalol 21 Creating Data https://github.com/tomakehurst/wiremock
  • 22. credit to @mogronalol 22 Proxy Mode Consumer Producer Service Virtualisation Tool
  • 23. credit to @mogronalol 23 Webserver / Facade Mode Consumer Producer Service Virtualisation Tool
  • 24. credit to @mogronalol 24 Not Mocking Service Under Test Mocking Dependant Service Http Virtual Service Mocks bleed into the architectural boundary of your application
  • 25. credit to @mogronalol 25 Open Source Tooling
  • 26. credit to @mogronalol 26 Record and replay Consumer External Producer Service Virtualisati on Tool
  • 27. credit to @mogronalol 27 JUnit Example @Rule public HoverflyRule hoverflyRule = HoverflyRule.inCaptureMode(“src/test/ resources/external.json").build(); @Test
 public void shouldBeAbleToRetrieveABooking() throws URISyntaxException {
 // Given
 final int bookingId = 1;
 
 // When
 final Booking booking = bookingServiceGateway.getBooking(bookingId);
 
 // Then
 assertThat(booking.getCustomer()).isEqualTo(“Andrew Morgan”); assertThat(booking.getDate()).isEqualTo(LocalDate.of(2016,3,1));
 }
  • 28. credit to @mogronalol 28 JUnit Example {
 "data": [
 {
 "request": {
 "path": "/api/bookings/1",
 "method": "GET",
 "destination": "www.my-test.com",
 "query": null,
 "body": ""
 },
 "response": {
 "status": 200,
 "body": “{”customer”:”Andrew Morgan", ”date”: ”2016-03-01”}}}”,
 "headers": {
 "Content-Type": [
 "application/json"
 ]
 }
 }
 }
 ]
 }
  • 29. credit to @mogronalol 29 JUnit Example @Test
 public void shouldBeAbleToRetrieveABooking() throws URISyntaxException {
 // Given
 final int bookingId = 1;
 
 // When
 final Booking booking = bookingServiceGateway.getBooking(bookingId);
 
 // Then
 assertThat(booking.getCustomer()).isEqualTo(“Andrew Morgan”); assertThat(booking.getDate()).isEqualTo(LocalDate.of(2016,3,1));
 } @Rule public HoverflyRule hoverflyRule = HoverflyRule.buildFromClassPathResource(“external.json").build();
  • 30. credit to @mogronalol 30 Advantages • Isolation • Flaky dependencies • Rate limiting • Deterministic • Licensing
  • 31. credit to @mogronalol 31 Deployment and Infrastructure Consumer External Producer Virtual Service Internal Producer Internal Producer Internal Producer Virtual Service Virtual Service Virtual Service
  • 32. credit to @mogronalol 32 CLI Example $ hoverctl start —proxy-port 8080 $ hoverctl import accounts-service-simulation.json $ hoverctl start —proxy-port 8081 $ hoverctl import payments-service-simulation.json $ curl http://www.account-service.com/api/v1/accounts/1 —proxy http:// localhost:8080 [{"name":"foo"}] $ curl http://www.payment-service.com/api/v1/payments/1 -proxy http:// localhost:8081 [{“amount":"£23.27"}]
  • 33. Hands-on session • Exercise 1: Explore an application that needs testing and create the simulations required to test it independently • Exercise 2: Test the circuit breakers in an application using Hoverfly • Code available: • https://github.com/benjih/oreilly-docker-java-shopping • Edze, Tom, Daniel, Benji and John will be around for help if needed (and feel free to work with others!)
  • 35. If you create simulations of components… … then individual components can be tested in isolation.
  • 36. A simulation of a component behaves like the real thing… … it misbehaves like the real thing… So you can create a realistic, repeatable test environment… … and automate all the things.
  • 37. github.com/SpectoLabs/hoverfly specto.io/blog We run public and private training workshops: contact@specto.io