SlideShare a Scribd company logo
βetamax
       Rob Fletcher
Freeside Software / Energized Work
The impetus
HTTP connections in tests
Solution 1: Fake HTTP Server
Solution 2: Mock HTTP layer
Tests need to be…
Tests need to be…

  Repeatable
    Reliable
   Realistic
Meanwhile in Ruby…




https://www.relishapp.com/myronmarston/vcr
Porting to JVM / Groovy
The Betamax Proxy
Using Betamax: JUnit
class TwitterServiceTest {

    @Rule public Recorder recorder = new Recorder()

    def twitterService = new TwitterService()

    @Betamax(tape = "twitter ok")
    @Test void searchesTweets() {
        def tweets = twitterService.search("#cocktailclub")

        assert tweets.size() == 20
        assert tweets.text.every { it =~ /#cocktailclub/ }
    }
}
Using Betamax: Spock
class TwitterServiceSpec extends Specification {

    @Rule Recorder recorder = new Recorder()

    def twitterService = new TwitterService()

    @Betamax(tape = "twitter ok")
    def "searches tweets"() {
        when:
        def tweets = twitterService.search("#cocktailclub")

        then:
        tweets.size() == 20
        tweets.text.every { it =~ /#cocktailclub/ }
    }
}
Matching Requests to Tapes
import static betamax.MatchRule.*


@Betamax()
@Betamax(match = host)
@Betamax(match = [method, uri, body])
@Betamax(match = [method, uri, headers])
@Betamax(match = [method, host, path])
Tape modes

import static betamax.TapeMode.*



@Betamax(mode = READ_WRITE)

@Betamax(mode = READ_ONLY)

@Betamax(mode = WRITE_ONLY)
Tape Files
Testing Practices
An example would be nice
      right now…
The future of Betamax




github.com/robfletcher/betamax/issues
http://freeside.co/betamax
@betamaxtest


http://freeside.co
@rfletcherEW

More Related Content

What's hot

Chap3 clientsrvr
Chap3 clientsrvrChap3 clientsrvr
Chap3 clientsrvr
Rachid Lajouad
 
RabbitMQ for Perl mongers
RabbitMQ for Perl mongersRabbitMQ for Perl mongers
RabbitMQ for Perl mongers
Lenz Gschwendtner
 
PHP at Density and Scale
PHP at Density and ScalePHP at Density and Scale
PHP at Density and Scale
David Timothy Strauss
 
QUIC
QUICQUIC
Python session.11 By Shanmugam
Python session.11 By ShanmugamPython session.11 By Shanmugam
Python session.11 By ShanmugamNavaneethan Naveen
 
Picobgp - A simple deamon for routing advertising
Picobgp - A simple deamon for routing advertisingPicobgp - A simple deamon for routing advertising
Picobgp - A simple deamon for routing advertisingClaudio Mignanti
 
What is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 editionWhat is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 edition
Igalia
 
A user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management toolsA user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management tools
SaltStack
 
AventX 10.0 is Here and it's Fast!
AventX 10.0 is Here and it's Fast!AventX 10.0 is Here and it's Fast!
AventX 10.0 is Here and it's Fast!
STR Software
 
vbench: lightweight performance testing for Python
vbench: lightweight performance testing for Pythonvbench: lightweight performance testing for Python
vbench: lightweight performance testing for PythonWes McKinney
 
Doc 20180117-wa0004
Doc 20180117-wa0004Doc 20180117-wa0004
Doc 20180117-wa0004
Bada Sainath
 
Powershell direct
Powershell directPowershell direct
Powershell direct
Naseem Khoodoruth
 
Introduction to Reactive Java
Introduction to Reactive JavaIntroduction to Reactive Java
Introduction to Reactive Java
Tomasz Kowalczewski
 
Support pattern
Support patternSupport pattern
Support pattern
aravindrkr
 
Salt at school
Salt at schoolSalt at school
Salt at school
Flavio Castelli
 
Andro sec rl-prototype-finalproject
Andro sec rl-prototype-finalprojectAndro sec rl-prototype-finalproject
Andro sec rl-prototype-finalproject
LiadBercovich
 
JActor Cluster Platform
JActor Cluster PlatformJActor Cluster Platform
JActor Cluster Platform
Bill La Forge
 
Software Testing
Software TestingSoftware Testing
Software Testing
Lambert Lum
 
Cql – cassandra query language
Cql – cassandra query languageCql – cassandra query language
Cql – cassandra query language
Courtney Robinson
 

What's hot (20)

Perl ides
Perl idesPerl ides
Perl ides
 
Chap3 clientsrvr
Chap3 clientsrvrChap3 clientsrvr
Chap3 clientsrvr
 
RabbitMQ for Perl mongers
RabbitMQ for Perl mongersRabbitMQ for Perl mongers
RabbitMQ for Perl mongers
 
PHP at Density and Scale
PHP at Density and ScalePHP at Density and Scale
PHP at Density and Scale
 
QUIC
QUICQUIC
QUIC
 
Python session.11 By Shanmugam
Python session.11 By ShanmugamPython session.11 By Shanmugam
Python session.11 By Shanmugam
 
Picobgp - A simple deamon for routing advertising
Picobgp - A simple deamon for routing advertisingPicobgp - A simple deamon for routing advertising
Picobgp - A simple deamon for routing advertising
 
What is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 editionWhat is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 edition
 
A user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management toolsA user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management tools
 
AventX 10.0 is Here and it's Fast!
AventX 10.0 is Here and it's Fast!AventX 10.0 is Here and it's Fast!
AventX 10.0 is Here and it's Fast!
 
vbench: lightweight performance testing for Python
vbench: lightweight performance testing for Pythonvbench: lightweight performance testing for Python
vbench: lightweight performance testing for Python
 
Doc 20180117-wa0004
Doc 20180117-wa0004Doc 20180117-wa0004
Doc 20180117-wa0004
 
Powershell direct
Powershell directPowershell direct
Powershell direct
 
Introduction to Reactive Java
Introduction to Reactive JavaIntroduction to Reactive Java
Introduction to Reactive Java
 
Support pattern
Support patternSupport pattern
Support pattern
 
Salt at school
Salt at schoolSalt at school
Salt at school
 
Andro sec rl-prototype-finalproject
Andro sec rl-prototype-finalprojectAndro sec rl-prototype-finalproject
Andro sec rl-prototype-finalproject
 
JActor Cluster Platform
JActor Cluster PlatformJActor Cluster Platform
JActor Cluster Platform
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Cql – cassandra query language
Cql – cassandra query languageCql – cassandra query language
Cql – cassandra query language
 

Viewers also liked

Betamax vs vhs
Betamax vs vhsBetamax vs vhs
Betamax vs vhs
NormaGH
 
VHS or Betamax - Coca Cola, Adam Forde.
VHS or Betamax - Coca Cola, Adam Forde.VHS or Betamax - Coca Cola, Adam Forde.
VHS or Betamax - Coca Cola, Adam Forde.
Global Business Intelligence
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
GR8Conf
 
1c presentation-vh svs-beta
1c  presentation-vh svs-beta1c  presentation-vh svs-beta
1c presentation-vh svs-betaBoris Cordero
 
2b apple story in picts
2b  apple story in picts2b  apple story in picts
2b apple story in pictsBoris Cordero
 
Betamax failure
Betamax failureBetamax failure
Betamax failure
Maria Iqbal
 
Sony betamax
Sony betamaxSony betamax
VHS vs Betamax - Listen to Customer
VHS vs Betamax - Listen to CustomerVHS vs Betamax - Listen to Customer
VHS vs Betamax - Listen to CustomerMurali Erraguntala
 
Failed Marketing Strategies of Big Brand Like Unilever
Failed Marketing Strategies of Big Brand Like UnileverFailed Marketing Strategies of Big Brand Like Unilever
Failed Marketing Strategies of Big Brand Like Unilever
HITESH BHARTI
 
Product relaunch and rebranding power point
Product relaunch and rebranding power point Product relaunch and rebranding power point
Product relaunch and rebranding power point
BUEntrepreneurship
 
failure products
failure productsfailure products
failure products
Rakesh Bhaskar
 
Unsuccessful products
Unsuccessful productsUnsuccessful products
Unsuccessful productsabhishek_g
 
Big Brand Failures
Big Brand FailuresBig Brand Failures
Big Brand Failures
Bianca Cawthorne
 

Viewers also liked (14)

Betamax vs vhs
Betamax vs vhsBetamax vs vhs
Betamax vs vhs
 
VHS or Betamax - Coca Cola, Adam Forde.
VHS or Betamax - Coca Cola, Adam Forde.VHS or Betamax - Coca Cola, Adam Forde.
VHS or Betamax - Coca Cola, Adam Forde.
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
 
Vhs
VhsVhs
Vhs
 
1c presentation-vh svs-beta
1c  presentation-vh svs-beta1c  presentation-vh svs-beta
1c presentation-vh svs-beta
 
2b apple story in picts
2b  apple story in picts2b  apple story in picts
2b apple story in picts
 
Betamax failure
Betamax failureBetamax failure
Betamax failure
 
Sony betamax
Sony betamaxSony betamax
Sony betamax
 
VHS vs Betamax - Listen to Customer
VHS vs Betamax - Listen to CustomerVHS vs Betamax - Listen to Customer
VHS vs Betamax - Listen to Customer
 
Failed Marketing Strategies of Big Brand Like Unilever
Failed Marketing Strategies of Big Brand Like UnileverFailed Marketing Strategies of Big Brand Like Unilever
Failed Marketing Strategies of Big Brand Like Unilever
 
Product relaunch and rebranding power point
Product relaunch and rebranding power point Product relaunch and rebranding power point
Product relaunch and rebranding power point
 
failure products
failure productsfailure products
failure products
 
Unsuccessful products
Unsuccessful productsUnsuccessful products
Unsuccessful products
 
Big Brand Failures
Big Brand FailuresBig Brand Failures
Big Brand Failures
 

Similar to Betamax

SmokeTests
SmokeTestsSmokeTests
Using Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RSUsing Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RSKatrien Verbert
 
Building an Interactive Query Service in Kafka Streams With Bill Bejeck | Cur...
Building an Interactive Query Service in Kafka Streams With Bill Bejeck | Cur...Building an Interactive Query Service in Kafka Streams With Bill Bejeck | Cur...
Building an Interactive Query Service in Kafka Streams With Bill Bejeck | Cur...
HostedbyConfluent
 
MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介
kwatch
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
Ankit Minocha
 
Apex Testing and Best Practices
Apex Testing and Best PracticesApex Testing and Best Practices
Apex Testing and Best Practices
Jitendra Zaa
 
The HTML5 WebSocket API
The HTML5 WebSocket APIThe HTML5 WebSocket API
The HTML5 WebSocket API
David Lindkvist
 
New Component Patterns in Ember.js
New Component Patterns in Ember.jsNew Component Patterns in Ember.js
New Component Patterns in Ember.js
Matthew Beale
 
Testing the frontend
Testing the frontendTesting the frontend
Testing the frontend
Heiko Hardt
 
AD102 - Break out of the Box
AD102 - Break out of the BoxAD102 - Break out of the Box
AD102 - Break out of the Box
Karl-Henry Martinsson
 
4 JVM Web Frameworks
4 JVM Web Frameworks4 JVM Web Frameworks
4 JVM Web Frameworks
Joe Kutner
 
Scaling Ruby with Evented I/O - Ruby underground
Scaling Ruby with Evented I/O - Ruby undergroundScaling Ruby with Evented I/O - Ruby underground
Scaling Ruby with Evented I/O - Ruby underground
Omer Gazit
 
Testing Java Microservices Devoxx be 2017
Testing Java Microservices Devoxx be 2017Testing Java Microservices Devoxx be 2017
Testing Java Microservices Devoxx be 2017
Alex Soto
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
kamal kotecha
 
Arquillian Constellation
Arquillian ConstellationArquillian Constellation
Arquillian Constellation
Alex Soto
 
Qtp not just for gui anymore
Qtp   not just for gui anymoreQtp   not just for gui anymore
Qtp not just for gui anymorePragya Rastogi
 
T2
T2T2
T2
Mo Ch
 
Pushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax WPushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax Wrajivmordani
 
Streaming twitter data using kafka
Streaming twitter data using kafkaStreaming twitter data using kafka
Streaming twitter data using kafka
Kiran Krishna
 

Similar to Betamax (20)

SmokeTests
SmokeTestsSmokeTests
SmokeTests
 
Using Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RSUsing Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RS
 
Building an Interactive Query Service in Kafka Streams With Bill Bejeck | Cur...
Building an Interactive Query Service in Kafka Streams With Bill Bejeck | Cur...Building an Interactive Query Service in Kafka Streams With Bill Bejeck | Cur...
Building an Interactive Query Service in Kafka Streams With Bill Bejeck | Cur...
 
MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
Apex Testing and Best Practices
Apex Testing and Best PracticesApex Testing and Best Practices
Apex Testing and Best Practices
 
The HTML5 WebSocket API
The HTML5 WebSocket APIThe HTML5 WebSocket API
The HTML5 WebSocket API
 
New Component Patterns in Ember.js
New Component Patterns in Ember.jsNew Component Patterns in Ember.js
New Component Patterns in Ember.js
 
Testing the frontend
Testing the frontendTesting the frontend
Testing the frontend
 
AD102 - Break out of the Box
AD102 - Break out of the BoxAD102 - Break out of the Box
AD102 - Break out of the Box
 
4 JVM Web Frameworks
4 JVM Web Frameworks4 JVM Web Frameworks
4 JVM Web Frameworks
 
Scaling Ruby with Evented I/O - Ruby underground
Scaling Ruby with Evented I/O - Ruby undergroundScaling Ruby with Evented I/O - Ruby underground
Scaling Ruby with Evented I/O - Ruby underground
 
Testing Java Microservices Devoxx be 2017
Testing Java Microservices Devoxx be 2017Testing Java Microservices Devoxx be 2017
Testing Java Microservices Devoxx be 2017
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
 
Arquillian Constellation
Arquillian ConstellationArquillian Constellation
Arquillian Constellation
 
Qtp not just for gui anymore
Qtp   not just for gui anymoreQtp   not just for gui anymore
Qtp not just for gui anymore
 
T2
T2T2
T2
 
Solr @ Etsy - Apache Lucene Eurocon
Solr @ Etsy - Apache Lucene EuroconSolr @ Etsy - Apache Lucene Eurocon
Solr @ Etsy - Apache Lucene Eurocon
 
Pushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax WPushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax W
 
Streaming twitter data using kafka
Streaming twitter data using kafkaStreaming twitter data using kafka
Streaming twitter data using kafka
 

More from GR8Conf

DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your Team
GR8Conf
 
Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle
GR8Conf
 
Mum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developerMum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developer
GR8Conf
 
Metaprogramming with Groovy
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with Groovy
GR8Conf
 
Scraping with Geb
Scraping with GebScraping with Geb
Scraping with Geb
GR8Conf
 
How to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and AndroidHow to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and Android
GR8Conf
 
Ratpack On the Docks
Ratpack On the DocksRatpack On the Docks
Ratpack On the Docks
GR8Conf
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Code
GR8Conf
 
Cut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature pluginsCut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature plugins
GR8Conf
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applications
GR8Conf
 
Ratpack and Grails 3
 Ratpack and Grails 3 Ratpack and Grails 3
Ratpack and Grails 3
GR8Conf
 
Grails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloudGrails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloud
GR8Conf
 
Functional testing your Grails app with GEB
Functional testing your Grails app with GEBFunctional testing your Grails app with GEB
Functional testing your Grails app with GEB
GR8Conf
 
Deploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPCDeploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPC
GR8Conf
 
The Grails introduction workshop
The Grails introduction workshopThe Grails introduction workshop
The Grails introduction workshop
GR8Conf
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spock
GR8Conf
 
The Groovy Ecosystem Revisited
The Groovy Ecosystem RevisitedThe Groovy Ecosystem Revisited
The Groovy Ecosystem Revisited
GR8Conf
 
Groovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examplesGroovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examples
GR8Conf
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
GR8Conf
 
Grooscript gr8conf
Grooscript gr8confGrooscript gr8conf
Grooscript gr8conf
GR8Conf
 

More from GR8Conf (20)

DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your Team
 
Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle
 
Mum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developerMum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developer
 
Metaprogramming with Groovy
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with Groovy
 
Scraping with Geb
Scraping with GebScraping with Geb
Scraping with Geb
 
How to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and AndroidHow to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and Android
 
Ratpack On the Docks
Ratpack On the DocksRatpack On the Docks
Ratpack On the Docks
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Code
 
Cut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature pluginsCut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature plugins
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applications
 
Ratpack and Grails 3
 Ratpack and Grails 3 Ratpack and Grails 3
Ratpack and Grails 3
 
Grails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloudGrails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloud
 
Functional testing your Grails app with GEB
Functional testing your Grails app with GEBFunctional testing your Grails app with GEB
Functional testing your Grails app with GEB
 
Deploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPCDeploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPC
 
The Grails introduction workshop
The Grails introduction workshopThe Grails introduction workshop
The Grails introduction workshop
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spock
 
The Groovy Ecosystem Revisited
The Groovy Ecosystem RevisitedThe Groovy Ecosystem Revisited
The Groovy Ecosystem Revisited
 
Groovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examplesGroovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examples
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
 
Grooscript gr8conf
Grooscript gr8confGrooscript gr8conf
Grooscript gr8conf
 

Recently uploaded

Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and LoveMeet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
get joys
 
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog EternalMeet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
Blog Eternal
 
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to StardomYoung Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
greendigital
 
I Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledgeI Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledge
Sabrina Ricci
 
This Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I MadeThis Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I Made
Aarush Ghate
 
Skeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on ForumSkeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on Forum
Isaac More
 
240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf
Madhura TBRC
 
Scandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.zaScandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.za
Isaac More
 
Hollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest galleryHollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest gallery
Zsolt Nemeth
 
Reimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a SuccessReimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a Success
Mark Murphy Director
 
The Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy DirectorThe Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy Director
Mark Murphy Director
 
Tom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive AnalysisTom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive Analysis
greendigital
 
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdfCreate a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Genny Knight
 
Panchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdfPanchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdf
Suleman Rana
 
A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024
Indira Srivatsa
 
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles onlineTreasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Hidden Treasure Hunts
 
Christina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptxChristina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptx
madeline604788
 
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdfMaximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Xtreame HDTV
 
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
Rodney Thomas Jr
 

Recently uploaded (19)

Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and LoveMeet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
 
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog EternalMeet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
 
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to StardomYoung Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
 
I Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledgeI Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledge
 
This Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I MadeThis Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I Made
 
Skeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on ForumSkeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on Forum
 
240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf
 
Scandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.zaScandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.za
 
Hollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest galleryHollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest gallery
 
Reimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a SuccessReimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a Success
 
The Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy DirectorThe Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy Director
 
Tom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive AnalysisTom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive Analysis
 
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdfCreate a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
 
Panchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdfPanchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdf
 
A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024
 
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles onlineTreasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
 
Christina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptxChristina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptx
 
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdfMaximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
 
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
 

Betamax

Editor's Notes

  1. \n
  2. As you scroll around AJAX requests are triggered to pull in TV listings\nData from REST services\nChannel list\n‘Chunks’ of programme data (4 hours x 10 channels)\nIndividual programme details\nWe have tests for…\nAll kinds of data conditions\nError handling, 404s, 503s\nEmpty responses\n
  3. Want to talk about the problems Betamax addresses…\n\nIn unit tests components-under-test should be isolated\nEven end-to-end shouldn’t rely on resources outside your control\nHTTP makes tests brittle:\n3rd party outages break your tests\nResource limits break your tests\nCorporate network environment break your tests\nCoding on the go breaks your tests\nCan only test edge cases accidentally:\nwhat does your client do when… server is down?\nrate limit hit?\nit gets an invalid response?\nThis is *really* unacceptable on CI servers\n\n
  4. Spin up an in-process instance of Sun webserver or jetty\n\nIt’s tedious to hand-craft responses\nTemptation is to oversimplify\n\nSmall differences may matter (headers, text encoding, content length)\nReinventing the wheel\nApplication needs configurable URLs or you have to DNS hack\n
  5. May not be easy to inject mock\neasy for DI collaborators like an HttpClient instance\nnot so easy for new URL("http://example.com").text\nHttpClient not the most mock-friendly API\nRemember… every time a mock returns a mock a fairy dies\n
  6. Repeatable:\nreturn consistent, predictable responses not just whatever server happens to be returning right now\n\nReliable:\nnot affected by 3rd party downtime\nnot affected by network availability\n\nRealistic:\nsimulate the real response correctly\n
  7. Layer on top of Ruby HTTP mocking libraries like WebMock\nUses the metaphor of a ‘cassette’ with recorded responses\n
  8. Goals:\nIdeally not just Groovy - JVM\nHandle various ways of connecting:\nURL\nURLConnection\nHttpClient\nHTTPBuilder\nChallenges:\nCan’t use Groovy MOP in non-Groovy scenario\nEven in Groovy the underlying code where HTTP connection is made is often Java\nAOP might work for DI but can’t intercept new URL("http://example.com").text\nCan’t even use metaClass as Groovy implementation written in Java\nThe name - Why Betamax? \n
  9. Can intercept just about anything\nEasy to enable and disable programatically with system properties\nEven proxy is problematic:\nHttpClient ignores it by default\nHTTPS - it’s a man-in-the-middle attack\nProxy implemented with embedded Jetty\nTried different things but used because of lifecycle callbacks\nvert.x would be even nicer but would require Java 7\n\n\n
  10. Explain what’s going on here:\nTwitterService makes REST connections to Twitter - let’s assume with URL but could be anything\n\n@Rule - JUnit\n@Betamax annotation on each test\nMultiple tests can share tapes\nTapes can hold multiple recordings\nPer-test configuration via annotation\nExplain request matching\nDefault method & uri\nDefault ideal for REST\nCan use other things; path, headers, request content, etc. (next slide)\n\n
  11. Nothing different\nJUnit rules work in Spock\n
  12. Default = method and uri\nIdeal for connecting to REST services\nMatch any request using any method going to the same host\nMatch requests based on POSTed data\nDifferent responses for different headers\ntest response to cache control headers\nsimulate different responses for different user-agent strings\nimprovements to be made - currently it matches all the headers\nIgnore query string\nuseful if requests add things like cache-busters or session ids (when not relevant to test)\n
  13. 1 - default - can record new exchanges or play back existing ones\n2 - useful when you want to ensure you’ve captured everything - proxy returns error if recording not found\n3 - Overwrite mode - any existing recordings are overwritten\n
  14. Why YAML?\nTried JSON - delimiter collision\nEditing\nBinary\n
  15. Where does Betamax fit into your test architecture?\nUsing Betamax doesn’t mean you don’t need to isolate your HTTP interactions\nBuild a higher-level API around the HTTP connection code\ntest that with @Betamax\nmock it out in other code that depends on it\nDon’t just slap @Betamax on every test\nHowever, Betamax can be useful in end-to-end tests\n\n“You’re probably thinking…”\n
  16. \n
  17. Current status: early days but fully usable\n1.1-SNAPSHOT\n\nHTTPS support\nPrettified response bodies in tapes?\nVCR feature envy…\nCustom recording matching\nSpecific headers or body content\nGroovy expressions in tape files?\nVCR allows ERB expressions in cassette files\nSnakeyaml allows for this kind of thing\nWould have made a good hackergarten project\nAuto-expiring tapes?\nSimple HttpClient decorator as an alternative to the proxy?\nCould use MOP to intercept URL.text\nSolution for URL.openConnection?\n\n
  18. Example Grails app included\n