SlideShare a Scribd company logo
1 of 37
Download to read offline
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 ProductionDaniel Bryant
 
Continuous Performance Testing
Continuous Performance TestingContinuous Performance Testing
Continuous Performance TestingC4Media
 
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 callMicheleNati
 
[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 CloudTechWell
 
Vertical Slicing Architectures
Vertical Slicing ArchitecturesVertical Slicing Architectures
Vertical Slicing ArchitecturesVictor Rentea
 
'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 WrightTEST 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 ecosystemsNuno 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 happyIordanis (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
 
Testing strategies in microservices
Testing strategies in microservicesTesting strategies in microservices
Testing strategies in microservicesGeekNightHyderabad
 
Manoj kolhe - Continuous Integration Testing
Manoj kolhe - Continuous Integration TestingManoj kolhe - Continuous Integration Testing
Manoj kolhe - Continuous Integration TestingManoj 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 TestParasoft
 
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 MicroservicesSteve 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 TestingSampath 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

Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 

Recently uploaded (20)

Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 

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