SlideShare une entreprise Scribd logo
1  sur  22
MOUNTEBANK AND
YOU
Nagesh Kumar
nkumar@thoughtworks.com
1
AGENDA
Integration Testing
Isolation Testing
Real Problem
Mountebank
Quick Watch
Whom to Catch
2
Test multiple components at the same time
No GUI
No faking/mocking/stubbing/etc
Need Real things to Integrate With
Real Services must be reliable and need to be fast
THE CLASSICAL VIEW OF INTEGRATION TESTING
3
THE CLASSICAL VIEW OF ISOLATION TESTING
4
Test as many real components at the same time
Stub out the unreliable Real Dependency
Stub out the non-existing Real Dependency
Testing our code while isolating it from the naughty Real
Dependency
YOU CAN’T ALWAYS FIX THE REAL PROBLEM (SAD, BUT TRUE)
5
Real Things being maintained/developed by other teams
Poor testing environment (Hardware, Data, Other)
Fixing the Real Thing is more costly than enduring it
Client won’t pay us to fix the Real Things
WHAT IS MOUNTEBANK?
“mountebank is the
first tool to provide
cross-platform, multi-
protocol test doubles
over the wire.”
- mountebank
6
http://www.mbtest.org/
WHY MOUNTEBANK?
Proprietary
Lacked platform support
Lacked protocol support
Not extensible
Slow
Hard to run during unit test cycle
Managed through a special IDE
7
Existing tools were:
WHAT CAN IT DO FOR ME?
Record live requests and responses to replay later
Imitate a response from scratch
Respond to specific requests via predicates
Track any requests that come its way
8
AN OVERVIEW OF MOUNTEBANK IN ACTION
System
Under Test
Tests
Mountebank
Stub
WHAT DO I NEED TO KNOW IN MB?
Imposters
Predicates
Proxies
Injection
Behaviors
10
WHAT ARE IMPOSTERS?
The imposter is the
most integral part of
mountebank. An
imposter is associated
with a port number
and a protocol. It
contains within itself
the response we want
to return, and other
related information.
11
http://www.mbtest.org/docs/api/stubs
ANATOMY OF AN IMPOSTER
POST /imposters HTTP/1.1
Host: localhost:2525
Accept: application/json
Content-Type: application/json
{
"port": 4545,
"protocol": “http",
"stubs": [
{
"responses": [
{
"is": {
"statusCode": 200, (Will default to 200 if not provided)
“headers": {
“Content-Type": “text/plain“
},
"body": “Hello world!”
}
}
]
}
]
}
12
ANOTHER IMPOSTER EXAMPLE
POST /imposters HTTP/1.1
Host: localhost:2525
Accept: application/json
Content-Type: application/json
{
"port": 4546,
"protocol": "http",
"stubs": [
{
"responses": [
{
"is": {
"statusCode": 201,
“headers": {
“Content-Type": “text/plain“
},
"body": “Created!”
}
},
{
"is": {
"statusCode": 400,
“headers": {
“Content-Type": “text/plain“
},
"body": “ERROR: Already Exists!”
}
}
]
}
]
}
13
WHAT IS A PREDICATE?
The predicate is the
part of an imposter
which determines if a
request should be
responded to by said
imposter.
14
http://www.mbtest.org/docs/api/predicates
TYPES OF PREDICATES
Equals
Deep Equals
Contains
Starts/EndsWith
Matches
Exists
Not/And/Or
Inject
http://www.mbtest.org/docs/api/predicates
15
WHAT CAN A PREDICATE OPERATE ON?
That depends on the
protocol you’re using!
For example, Http
allows you to use
predicates on:
- Method Type
- Query Path
- Request Body
- And More!
16
http://www.mbtest.org/docs/protocols/http
PREDICATE EXAMPLE
{
"port": 4551,
"protocol": "http",
"stubs": [
{
"responses": [
{
"is": {
"statusCode": 201,
"headers": {
"Content-Type": "text/plain"
},
"body": "You posted to me!"
}
}
],
"predicates": [
{
"equals": {
"method": "POST"
}
}
]
}
]
}
17
OR EXAMPLE
{
"port": 4552,
"protocol": "http",
"stubs": [
{
"responses": [
{
"is": {
"statusCode": 201,
"headers": {
"Content-Type": "text/plain"
},
"body": "You posted to me!"
}
}
],
"predicates": [
{
"or": [
{
"equals": {
"method": "POST"
}
},
{
"equals": {
"method": "PUT"
}
}
]
}
]
}
]
}
18
WHAT IS A PROXY?
The proxy is a special
imposter which allows
us to get between our
application and a
service it
communicates with. It
records each request,
forwards it to the
service, and records
the response from that
service.
19
http://www.mbtest.org/docs/api/proxies
BUT WHAT DO I DO WITH IT?
Record responses that would be difficult (if not impossible)
to write by hand
Look at requests to see what distinguishes them from each
other
20
PROXY EXAMPLE
{
"port": 4560,
"protocol": "http",
"name": "duckduckgo",
"stubs": [
{
"responses": [
{
"proxy": {
"to": "http://api.duckduckgo.com/",
"mode": "proxyOnce",
"predicateGenerators": [
{
"matches": {
"method": true,
"path": true,
"query": true
}
}
]
}
}
]
}
]
}
21
Direct all Suggestions to Brandon
(bbyars@thoughtworks.com)
THANK YOU

Contenu connexe

Tendances

Test Design and Automation for REST API
Test Design and Automation for REST APITest Design and Automation for REST API
Test Design and Automation for REST APIIvan Katunou
 
Ppt of soap ui
Ppt of soap uiPpt of soap ui
Ppt of soap uipkslide28
 
Test your microservices with REST-Assured
Test your microservices with REST-AssuredTest your microservices with REST-Assured
Test your microservices with REST-AssuredMichel Schudel
 
Mock Server Using WireMock
Mock Server Using WireMockMock Server Using WireMock
Mock Server Using WireMockGlobant
 
B4USolution_API-Testing
B4USolution_API-TestingB4USolution_API-Testing
B4USolution_API-Testingb4usolution .
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web APIBrad Genereaux
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUDPrem Sanil
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introductionejlp12
 
Testing web services
Testing web servicesTesting web services
Testing web servicesTaras Lytvyn
 
API Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj RollisonAPI Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj RollisonTEST Huddle
 

Tendances (20)

Test Design and Automation for REST API
Test Design and Automation for REST APITest Design and Automation for REST API
Test Design and Automation for REST API
 
Rest assured
Rest assuredRest assured
Rest assured
 
Api testing
Api testingApi testing
Api testing
 
Ppt of soap ui
Ppt of soap uiPpt of soap ui
Ppt of soap ui
 
Test your microservices with REST-Assured
Test your microservices with REST-AssuredTest your microservices with REST-Assured
Test your microservices with REST-Assured
 
Mock Server Using WireMock
Mock Server Using WireMockMock Server Using WireMock
Mock Server Using WireMock
 
B4USolution_API-Testing
B4USolution_API-TestingB4USolution_API-Testing
B4USolution_API-Testing
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
 
API Testing
API TestingAPI Testing
API Testing
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
 
Spring boot
Spring bootSpring boot
Spring boot
 
Learn SoapUI
Learn SoapUILearn SoapUI
Learn SoapUI
 
Testing soap UI
Testing soap UITesting soap UI
Testing soap UI
 
Testing web services
Testing web servicesTesting web services
Testing web services
 
Hexagonal architecture
Hexagonal architectureHexagonal architecture
Hexagonal architecture
 
Spring boot
Spring bootSpring boot
Spring boot
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
API Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj RollisonAPI Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj Rollison
 
React Native
React NativeReact Native
React Native
 

En vedette

Testing & deploying Microservices GeeCon 2014
Testing & deploying Microservices   GeeCon 2014Testing & deploying Microservices   GeeCon 2014
Testing & deploying Microservices GeeCon 2014Sam Newman
 
Spring boot - Getting Started
Spring boot - Getting StartedSpring boot - Getting Started
Spring boot - Getting StartedDavid Schmitz
 
JavaOne 2015: Scalable Continous Deployment with Maven
JavaOne 2015: Scalable Continous Deployment with MavenJavaOne 2015: Scalable Continous Deployment with Maven
JavaOne 2015: Scalable Continous Deployment with MavenAbraham Marin-Perez
 
Resilience testing with Wiremock and Spock
Resilience testing with Wiremock and SpockResilience testing with Wiremock and Spock
Resilience testing with Wiremock and SpockDavid Schmitz
 
Agile roundabout 2017 01 - keeping your ci-cd system as fast as it needs to be
Agile roundabout 2017 01 - keeping your ci-cd system as fast as it needs to beAgile roundabout 2017 01 - keeping your ci-cd system as fast as it needs to be
Agile roundabout 2017 01 - keeping your ci-cd system as fast as it needs to beAbraham Marin-Perez
 
Cursos Agile Think - Lean - 2/4
Cursos Agile Think - Lean - 2/4Cursos Agile Think - Lean - 2/4
Cursos Agile Think - Lean - 2/4André Vidal
 
Increase Your Intelligence 2014
Increase Your Intelligence 2014Increase Your Intelligence 2014
Increase Your Intelligence 2014Andrea Kuszewski
 
Cursos Agile Think - Kanban - 3/4
Cursos Agile Think - Kanban - 3/4Cursos Agile Think - Kanban - 3/4
Cursos Agile Think - Kanban - 3/4André Vidal
 
Cursos Agile Think - Feature Driven Development (FDD) - 4/4
Cursos Agile Think - Feature Driven Development (FDD) - 4/4Cursos Agile Think - Feature Driven Development (FDD) - 4/4
Cursos Agile Think - Feature Driven Development (FDD) - 4/4André Vidal
 
Expert Talks Cardiff 2017 - Keeping your ci-cd system as fast as it needs to be
Expert Talks Cardiff 2017 - Keeping your ci-cd system as fast as it needs to beExpert Talks Cardiff 2017 - Keeping your ci-cd system as fast as it needs to be
Expert Talks Cardiff 2017 - Keeping your ci-cd system as fast as it needs to beAbraham Marin-Perez
 
Keeping your CI/CD pipeline as fast as it needs to be
Keeping your CI/CD pipeline as fast as it needs to beKeeping your CI/CD pipeline as fast as it needs to be
Keeping your CI/CD pipeline as fast as it needs to beAbraham Marin-Perez
 
Creative Disobedience: How, When and Why to Break the Rules (from BIL 2014)
Creative Disobedience: How, When and Why to Break the Rules (from BIL 2014)Creative Disobedience: How, When and Why to Break the Rules (from BIL 2014)
Creative Disobedience: How, When and Why to Break the Rules (from BIL 2014)Andrea Kuszewski
 
Cursos Agile Think - Framework Scrum - 1/4
Cursos Agile Think - Framework Scrum - 1/4Cursos Agile Think - Framework Scrum - 1/4
Cursos Agile Think - Framework Scrum - 1/4André Vidal
 
Livro AGILE THINK® CANVAS
Livro AGILE THINK® CANVAS Livro AGILE THINK® CANVAS
Livro AGILE THINK® CANVAS André Vidal
 
Merge hells!! feature toggles to the rescue
Merge hells!! feature toggles to the rescueMerge hells!! feature toggles to the rescue
Merge hells!! feature toggles to the rescueLeena N
 
Keeping Your CI/CD Pipeline as Fast as It Needs to Be
Keeping Your CI/CD Pipeline as Fast as It Needs to BeKeeping Your CI/CD Pipeline as Fast as It Needs to Be
Keeping Your CI/CD Pipeline as Fast as It Needs to BeAbraham Marin-Perez
 
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...OpenWhisk
 
Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)Giovanni Asproni
 
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnReactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnZalando Technology
 

En vedette (20)

Testing & deploying Microservices GeeCon 2014
Testing & deploying Microservices   GeeCon 2014Testing & deploying Microservices   GeeCon 2014
Testing & deploying Microservices GeeCon 2014
 
Spring boot - Getting Started
Spring boot - Getting StartedSpring boot - Getting Started
Spring boot - Getting Started
 
JavaOne 2015: Scalable Continous Deployment with Maven
JavaOne 2015: Scalable Continous Deployment with MavenJavaOne 2015: Scalable Continous Deployment with Maven
JavaOne 2015: Scalable Continous Deployment with Maven
 
Resilience testing with Wiremock and Spock
Resilience testing with Wiremock and SpockResilience testing with Wiremock and Spock
Resilience testing with Wiremock and Spock
 
Agile roundabout 2017 01 - keeping your ci-cd system as fast as it needs to be
Agile roundabout 2017 01 - keeping your ci-cd system as fast as it needs to beAgile roundabout 2017 01 - keeping your ci-cd system as fast as it needs to be
Agile roundabout 2017 01 - keeping your ci-cd system as fast as it needs to be
 
Cursos Agile Think - Lean - 2/4
Cursos Agile Think - Lean - 2/4Cursos Agile Think - Lean - 2/4
Cursos Agile Think - Lean - 2/4
 
Increase Your Intelligence 2014
Increase Your Intelligence 2014Increase Your Intelligence 2014
Increase Your Intelligence 2014
 
Cursos Agile Think - Kanban - 3/4
Cursos Agile Think - Kanban - 3/4Cursos Agile Think - Kanban - 3/4
Cursos Agile Think - Kanban - 3/4
 
Cursos Agile Think - Feature Driven Development (FDD) - 4/4
Cursos Agile Think - Feature Driven Development (FDD) - 4/4Cursos Agile Think - Feature Driven Development (FDD) - 4/4
Cursos Agile Think - Feature Driven Development (FDD) - 4/4
 
Expert Talks Cardiff 2017 - Keeping your ci-cd system as fast as it needs to be
Expert Talks Cardiff 2017 - Keeping your ci-cd system as fast as it needs to beExpert Talks Cardiff 2017 - Keeping your ci-cd system as fast as it needs to be
Expert Talks Cardiff 2017 - Keeping your ci-cd system as fast as it needs to be
 
Keeping your CI/CD pipeline as fast as it needs to be
Keeping your CI/CD pipeline as fast as it needs to beKeeping your CI/CD pipeline as fast as it needs to be
Keeping your CI/CD pipeline as fast as it needs to be
 
Creative Disobedience: How, When and Why to Break the Rules (from BIL 2014)
Creative Disobedience: How, When and Why to Break the Rules (from BIL 2014)Creative Disobedience: How, When and Why to Break the Rules (from BIL 2014)
Creative Disobedience: How, When and Why to Break the Rules (from BIL 2014)
 
Cursos Agile Think - Framework Scrum - 1/4
Cursos Agile Think - Framework Scrum - 1/4Cursos Agile Think - Framework Scrum - 1/4
Cursos Agile Think - Framework Scrum - 1/4
 
Livro AGILE THINK® CANVAS
Livro AGILE THINK® CANVAS Livro AGILE THINK® CANVAS
Livro AGILE THINK® CANVAS
 
Merge hells!! feature toggles to the rescue
Merge hells!! feature toggles to the rescueMerge hells!! feature toggles to the rescue
Merge hells!! feature toggles to the rescue
 
Keeping Your CI/CD Pipeline as Fast as It Needs to Be
Keeping Your CI/CD Pipeline as Fast as It Needs to BeKeeping Your CI/CD Pipeline as Fast as It Needs to Be
Keeping Your CI/CD Pipeline as Fast as It Needs to Be
 
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
 
Agile Requirements
Agile RequirementsAgile Requirements
Agile Requirements
 
Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)
 
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnReactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
 

Similaire à Mountebank and you

Petr Dvořák: Mobilní webové služby pohledem iPhone developera
Petr Dvořák: Mobilní webové služby pohledem iPhone developeraPetr Dvořák: Mobilní webové služby pohledem iPhone developera
Petr Dvořák: Mobilní webové služby pohledem iPhone developeraWebExpo
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTPMykhailo Kolesnyk
 
Creating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with TestcontainersCreating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with TestcontainersPaul Balogh
 
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QAFest
 
Uni w pachube 111108
Uni w pachube 111108Uni w pachube 111108
Uni w pachube 111108Paul Tanner
 
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 
Cloud Platforms for Java
Cloud Platforms for JavaCloud Platforms for Java
Cloud Platforms for Java3Pillar Global
 
Nordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API DocumentationNordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API DocumentationRouven Weßling
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesAlfresco Software
 
12 core technologies you should learn, love, and hate to be a 'real' technocrat
12 core technologies you should learn, love, and hate to be a 'real' technocrat12 core technologies you should learn, love, and hate to be a 'real' technocrat
12 core technologies you should learn, love, and hate to be a 'real' technocratJonathan Linowes
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaYevgeniy Brikman
 
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...Yevgeniy Brikman
 
Serverless in production, an experience report (Going Serverless)
Serverless in production, an experience report (Going Serverless)Serverless in production, an experience report (Going Serverless)
Serverless in production, an experience report (Going Serverless)Yan Cui
 
2014 Joker - Integration Testing from the Trenches
2014 Joker - Integration Testing from the Trenches2014 Joker - Integration Testing from the Trenches
2014 Joker - Integration Testing from the TrenchesNicolas Fränkel
 
Innovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open InterfacesInnovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open InterfacesSteve Speicher
 
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...Future Processing
 
JavaLand - Integration Testing How-to
JavaLand - Integration Testing How-toJavaLand - Integration Testing How-to
JavaLand - Integration Testing How-toNicolas Fränkel
 
Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-TestingJava Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-TestingTal Melamed
 

Similaire à Mountebank and you (20)

Petr Dvořák: Mobilní webové služby pohledem iPhone developera
Petr Dvořák: Mobilní webové služby pohledem iPhone developeraPetr Dvořák: Mobilní webové služby pohledem iPhone developera
Petr Dvořák: Mobilní webové služby pohledem iPhone developera
 
- Webexpo 2010
- Webexpo 2010- Webexpo 2010
- Webexpo 2010
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTP
 
Creating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with TestcontainersCreating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with Testcontainers
 
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
 
Uni w pachube 111108
Uni w pachube 111108Uni w pachube 111108
Uni w pachube 111108
 
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
Cloud Platforms for Java
Cloud Platforms for JavaCloud Platforms for Java
Cloud Platforms for Java
 
Nordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API DocumentationNordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API Documentation
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
12 core technologies you should learn, love, and hate to be a 'real' technocrat
12 core technologies you should learn, love, and hate to be a 'real' technocrat12 core technologies you should learn, love, and hate to be a 'real' technocrat
12 core technologies you should learn, love, and hate to be a 'real' technocrat
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
 
Serverless in production, an experience report (Going Serverless)
Serverless in production, an experience report (Going Serverless)Serverless in production, an experience report (Going Serverless)
Serverless in production, an experience report (Going Serverless)
 
2014 Joker - Integration Testing from the Trenches
2014 Joker - Integration Testing from the Trenches2014 Joker - Integration Testing from the Trenches
2014 Joker - Integration Testing from the Trenches
 
Innovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open InterfacesInnovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open Interfaces
 
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
 
JavaLand - Integration Testing How-to
JavaLand - Integration Testing How-toJavaLand - Integration Testing How-to
JavaLand - Integration Testing How-to
 
Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-TestingJava Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
 

Plus de VodqaBLR

Consumer-Driven Contract Testing PACT
Consumer-Driven Contract Testing PACTConsumer-Driven Contract Testing PACT
Consumer-Driven Contract Testing PACTVodqaBLR
 
Taiko presentation
Taiko presentationTaiko presentation
Taiko presentationVodqaBLR
 
Chatbot Testing
Chatbot TestingChatbot Testing
Chatbot TestingVodqaBLR
 
Key Note VodQA(Bangalore) 2018
Key Note VodQA(Bangalore) 2018Key Note VodQA(Bangalore) 2018
Key Note VodQA(Bangalore) 2018VodqaBLR
 
Android security testing
Android security testingAndroid security testing
Android security testingVodqaBLR
 
Advance appium workshop.pptx
Advance appium workshop.pptxAdvance appium workshop.pptx
Advance appium workshop.pptxVodqaBLR
 
Blockchain workshop
Blockchain workshopBlockchain workshop
Blockchain workshopVodqaBLR
 
Testing natural language processing
Testing natural language processingTesting natural language processing
Testing natural language processingVodqaBLR
 
Drive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteerDrive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteerVodqaBLR
 
Improve your Chaos IQ
Improve your Chaos IQImprove your Chaos IQ
Improve your Chaos IQVodqaBLR
 
WebDriver Lamda - Next Gen Scalable Test
WebDriver Lamda - Next Gen Scalable TestWebDriver Lamda - Next Gen Scalable Test
WebDriver Lamda - Next Gen Scalable TestVodqaBLR
 
Testing Tools with AI
Testing Tools with AITesting Tools with AI
Testing Tools with AIVodqaBLR
 
Dynamic Security Analysis & Static Security Analysis for Android Apps.
Dynamic Security Analysis & Static Security Analysis for Android Apps.Dynamic Security Analysis & Static Security Analysis for Android Apps.
Dynamic Security Analysis & Static Security Analysis for Android Apps.VodqaBLR
 
Visual testing for Mobile Native Applications
Visual testing for Mobile Native ApplicationsVisual testing for Mobile Native Applications
Visual testing for Mobile Native ApplicationsVodqaBLR
 
Parallel Sim Test using XCUI
Parallel Sim Test using XCUI Parallel Sim Test using XCUI
Parallel Sim Test using XCUI VodqaBLR
 
Performance Testing using Taurus
Performance Testing using TaurusPerformance Testing using Taurus
Performance Testing using TaurusVodqaBLR
 
Writing Maintainable Tests
Writing Maintainable TestsWriting Maintainable Tests
Writing Maintainable TestsVodqaBLR
 
Continuous security testing - sharing responsibility
Continuous security testing - sharing responsibilityContinuous security testing - sharing responsibility
Continuous security testing - sharing responsibilityVodqaBLR
 
ABCing docker with environments - workshop
ABCing docker with environments - workshopABCing docker with environments - workshop
ABCing docker with environments - workshopVodqaBLR
 
Automate Web or Mobile Analytics using TrakMatic
Automate Web or Mobile Analytics using TrakMaticAutomate Web or Mobile Analytics using TrakMatic
Automate Web or Mobile Analytics using TrakMaticVodqaBLR
 

Plus de VodqaBLR (20)

Consumer-Driven Contract Testing PACT
Consumer-Driven Contract Testing PACTConsumer-Driven Contract Testing PACT
Consumer-Driven Contract Testing PACT
 
Taiko presentation
Taiko presentationTaiko presentation
Taiko presentation
 
Chatbot Testing
Chatbot TestingChatbot Testing
Chatbot Testing
 
Key Note VodQA(Bangalore) 2018
Key Note VodQA(Bangalore) 2018Key Note VodQA(Bangalore) 2018
Key Note VodQA(Bangalore) 2018
 
Android security testing
Android security testingAndroid security testing
Android security testing
 
Advance appium workshop.pptx
Advance appium workshop.pptxAdvance appium workshop.pptx
Advance appium workshop.pptx
 
Blockchain workshop
Blockchain workshopBlockchain workshop
Blockchain workshop
 
Testing natural language processing
Testing natural language processingTesting natural language processing
Testing natural language processing
 
Drive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteerDrive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteer
 
Improve your Chaos IQ
Improve your Chaos IQImprove your Chaos IQ
Improve your Chaos IQ
 
WebDriver Lamda - Next Gen Scalable Test
WebDriver Lamda - Next Gen Scalable TestWebDriver Lamda - Next Gen Scalable Test
WebDriver Lamda - Next Gen Scalable Test
 
Testing Tools with AI
Testing Tools with AITesting Tools with AI
Testing Tools with AI
 
Dynamic Security Analysis & Static Security Analysis for Android Apps.
Dynamic Security Analysis & Static Security Analysis for Android Apps.Dynamic Security Analysis & Static Security Analysis for Android Apps.
Dynamic Security Analysis & Static Security Analysis for Android Apps.
 
Visual testing for Mobile Native Applications
Visual testing for Mobile Native ApplicationsVisual testing for Mobile Native Applications
Visual testing for Mobile Native Applications
 
Parallel Sim Test using XCUI
Parallel Sim Test using XCUI Parallel Sim Test using XCUI
Parallel Sim Test using XCUI
 
Performance Testing using Taurus
Performance Testing using TaurusPerformance Testing using Taurus
Performance Testing using Taurus
 
Writing Maintainable Tests
Writing Maintainable TestsWriting Maintainable Tests
Writing Maintainable Tests
 
Continuous security testing - sharing responsibility
Continuous security testing - sharing responsibilityContinuous security testing - sharing responsibility
Continuous security testing - sharing responsibility
 
ABCing docker with environments - workshop
ABCing docker with environments - workshopABCing docker with environments - workshop
ABCing docker with environments - workshop
 
Automate Web or Mobile Analytics using TrakMatic
Automate Web or Mobile Analytics using TrakMaticAutomate Web or Mobile Analytics using TrakMatic
Automate Web or Mobile Analytics using TrakMatic
 

Dernier

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 

Dernier (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Mountebank and you

  • 2. AGENDA Integration Testing Isolation Testing Real Problem Mountebank Quick Watch Whom to Catch 2
  • 3. Test multiple components at the same time No GUI No faking/mocking/stubbing/etc Need Real things to Integrate With Real Services must be reliable and need to be fast THE CLASSICAL VIEW OF INTEGRATION TESTING 3
  • 4. THE CLASSICAL VIEW OF ISOLATION TESTING 4 Test as many real components at the same time Stub out the unreliable Real Dependency Stub out the non-existing Real Dependency Testing our code while isolating it from the naughty Real Dependency
  • 5. YOU CAN’T ALWAYS FIX THE REAL PROBLEM (SAD, BUT TRUE) 5 Real Things being maintained/developed by other teams Poor testing environment (Hardware, Data, Other) Fixing the Real Thing is more costly than enduring it Client won’t pay us to fix the Real Things
  • 6. WHAT IS MOUNTEBANK? “mountebank is the first tool to provide cross-platform, multi- protocol test doubles over the wire.” - mountebank 6 http://www.mbtest.org/
  • 7. WHY MOUNTEBANK? Proprietary Lacked platform support Lacked protocol support Not extensible Slow Hard to run during unit test cycle Managed through a special IDE 7 Existing tools were:
  • 8. WHAT CAN IT DO FOR ME? Record live requests and responses to replay later Imitate a response from scratch Respond to specific requests via predicates Track any requests that come its way 8
  • 9. AN OVERVIEW OF MOUNTEBANK IN ACTION System Under Test Tests Mountebank Stub
  • 10. WHAT DO I NEED TO KNOW IN MB? Imposters Predicates Proxies Injection Behaviors 10
  • 11. WHAT ARE IMPOSTERS? The imposter is the most integral part of mountebank. An imposter is associated with a port number and a protocol. It contains within itself the response we want to return, and other related information. 11 http://www.mbtest.org/docs/api/stubs
  • 12. ANATOMY OF AN IMPOSTER POST /imposters HTTP/1.1 Host: localhost:2525 Accept: application/json Content-Type: application/json { "port": 4545, "protocol": “http", "stubs": [ { "responses": [ { "is": { "statusCode": 200, (Will default to 200 if not provided) “headers": { “Content-Type": “text/plain“ }, "body": “Hello world!” } } ] } ] } 12
  • 13. ANOTHER IMPOSTER EXAMPLE POST /imposters HTTP/1.1 Host: localhost:2525 Accept: application/json Content-Type: application/json { "port": 4546, "protocol": "http", "stubs": [ { "responses": [ { "is": { "statusCode": 201, “headers": { “Content-Type": “text/plain“ }, "body": “Created!” } }, { "is": { "statusCode": 400, “headers": { “Content-Type": “text/plain“ }, "body": “ERROR: Already Exists!” } } ] } ] } 13
  • 14. WHAT IS A PREDICATE? The predicate is the part of an imposter which determines if a request should be responded to by said imposter. 14 http://www.mbtest.org/docs/api/predicates
  • 15. TYPES OF PREDICATES Equals Deep Equals Contains Starts/EndsWith Matches Exists Not/And/Or Inject http://www.mbtest.org/docs/api/predicates 15
  • 16. WHAT CAN A PREDICATE OPERATE ON? That depends on the protocol you’re using! For example, Http allows you to use predicates on: - Method Type - Query Path - Request Body - And More! 16 http://www.mbtest.org/docs/protocols/http
  • 17. PREDICATE EXAMPLE { "port": 4551, "protocol": "http", "stubs": [ { "responses": [ { "is": { "statusCode": 201, "headers": { "Content-Type": "text/plain" }, "body": "You posted to me!" } } ], "predicates": [ { "equals": { "method": "POST" } } ] } ] } 17
  • 18. OR EXAMPLE { "port": 4552, "protocol": "http", "stubs": [ { "responses": [ { "is": { "statusCode": 201, "headers": { "Content-Type": "text/plain" }, "body": "You posted to me!" } } ], "predicates": [ { "or": [ { "equals": { "method": "POST" } }, { "equals": { "method": "PUT" } } ] } ] } ] } 18
  • 19. WHAT IS A PROXY? The proxy is a special imposter which allows us to get between our application and a service it communicates with. It records each request, forwards it to the service, and records the response from that service. 19 http://www.mbtest.org/docs/api/proxies
  • 20. BUT WHAT DO I DO WITH IT? Record responses that would be difficult (if not impossible) to write by hand Look at requests to see what distinguishes them from each other 20
  • 21. PROXY EXAMPLE { "port": 4560, "protocol": "http", "name": "duckduckgo", "stubs": [ { "responses": [ { "proxy": { "to": "http://api.duckduckgo.com/", "mode": "proxyOnce", "predicateGenerators": [ { "matches": { "method": true, "path": true, "query": true } } ] } } ] } ] } 21
  • 22. Direct all Suggestions to Brandon (bbyars@thoughtworks.com) THANK YOU

Notes de l'éditeur

  1. Replace Real Things with Dependency