SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
T       O
    f
Rb W r      Joseph Wilk
W     ’
R b   fr   ?
Sr         ...

N R b             .

  R     .
“The number of languages you know
 corresponds to your programming
               skill”


           S
Y ... T
JUnit             ScrewUnit
Rspec             JBehave
PHPSpec           Jasmine
JSpec             Cucumber
Circumspec        BlahSpec
SomethingSpec     WhateverSpec
Y ... T
JUnit             ScrewUnit
Rspec               BORING!
                  JBehave
PHPSpec           Jasmine
JSpec             Cucumber
Circumspec        BlahSpec
SomethingSpec     WhateverSpec
T              &M
Ruby

Monkey.stub!(:new).and_return(mock("monkey"))



Java

I owe you one Java mocking example.

I don’t have the will power to write it.
Sorry.
T              &M
Ruby
                                 BORING!
Monkey.stub!(:new).and_return(mock("monkey"))



Java

I owe you one Java mocking example.

I don’t have the will power to write it.
Sorry.
I    r
  Asynchronous            Property testing


Permutation                      Model testing
explosions


  Metrics                       Test feedback


              Graphical tests
H
    Curry
“Program testing can be used to show the
presence of bugs, but never to show their
absence!”
                             Edsger Dijkstra
Q               C
               Properties



For all values of s the length of the thing
returned by five_random_characters is 5
Q         C
            Properties

            QuickCheck

            Randomly
Logic        generate    Function
               tests
Q         C
            Properties

            QuickCheck

            Randomly
Logic        generate    Function
               tests
Q         C
            Properties

            QuickCheck

            Randomly
Logic        generate    Function
               tests
Q         C
            Properties

            QuickCheck

            Randomly
Logic        generate    Function
               tests
Q         C
            Properties

            QuickCheck

            Randomly
Logic        generate    Function
               tests


                          Counter
                         Examples
Q              C
                     Properties


it "should reverse a string" do
  "monkeys".reverse.reverse.should == "monkeys"
end


100.times.map {“#{rand(10)}#{rand(10)}”}.each do |char|
  it "should reverse a string" do
    char.reverse.reverse.should == char
  end
end
Q             C
                    Properties

import Data.Char
import Test.QuickCheck

instance Arbitrary Char where
  arbitrary     = choose ('32', '128')
  coarbitrary c = variant (ord c `rem` 4)


prop_RevRev xs = reverse (reverse xs) == xs
  where types = xs::[Char]


$ Main> quickCheck prop_RevRev
OK, passed 100 tests.
Er
      Messaging/
     Concurrency
M Er   Models

    Erlang               McErlang
   runtime               runtime
    system                system


communication

 concurrency

 distribution
M Er Models



message       Messenger
                               “Scottish
“Scottish      Service
                               fiction”
fiction”




 Message    login    login   Message
  client                      client


  Fred                       Clara
M Er      Models
if user1 does not send a message m to user2 until user2 is logged on,
then
  if user1 does send a message m to user2
then
  eventually user2 receives the message m.


  "not P until Q => (eventually P => eventually R)”

  P: clara sends message “Scottish fiction” to fred
  Q: fred is logged on
  R: fred receives the message “Scottish fiction” from clara
M Er    Models
{program={scenario,start,[[
[{logon,clara},{message,fred,"hi"},logoff],
[{logon,fred},logoff]]]},

monitor={mce_ltl_parse:ltl_string2module_and_load
("not P until Q implies (eventually P implies
eventually R)", messenger_mon),
{void,[{'P',basicPredicates:message_to
(clara,fred,"hi")},
       {'Q',basicPredicates:logon(fred)},
       {'R',basicPredicates:message_received
(fred,clara,"hi")}]}},
  algorithm={mce_alg_buechi,void}}).
“Every method you use to prevent or find
bugs leaves a residue of subtler bugs against
which those methods are ineffectual

                         Pesticide Paradox / Beizer
C   r
    Bracket
      hell
M
                      Facts

(fact
 (alive-in-next-generation? ...cell...) => truthy
   (provided
    (alive? ...cell...) => false
    (neighbor-count ...cell...) => 3))




cell = mock("a cell")
cell.stub(:alive?).and_return(false)
cell.stub(:neighbour_count).and_return(3)

cell.alive_in_next_generation.should == true
I
    Brief visit
I
Specs are documentation
I
Specs are documentation
J v S rp
     Without
     the Java
Z        b .
Trapped inside a browser
Z           b .
               Trapped inside a browser
var zombie = require("zombie");
var assert = require("assert");

zombie.visit("http://localhost:3000/",
              function (err, browser, status) {

  browser.
    fill("email", "zombie@underworld.dead").
    pressButton("Sign Me Up!",
      function(err, browser, status) {

           assert.equal(browser.text("title"), "Welcome");
      })
});
V w
                    Topics


{ topic: function () { return 42 },

    'should be a number': function (topic) {
       assert.isNumber (topic);
    },
    'should be equal to 42': function (topic) {
       assert.equal (topic, 42);
    }
}
V w
                 Asynchronous calls


{ topic: function () {
     fs.stat('~/FILE', this.callback);
  },
  'can be accessed': function (err, stat) {
     assert.isNull   (err);        // We have no error
     assert.isObject (stat);       // We have a stat object
  },
  'is not empty': function (err, stat) {
     assert.isNotZero (stat.size); // The file size is > 0
  }
}
V w
                 Promises / Futures
{ topic: function () {
     var promise = new(events.EventEmitter);
     fs.stat('~/FILE', function (e, res) {
         if (e) { promise.emit('error', e) }
         else   { promise.emit('success', res) }
     });
     return promise;
  },
  'can be accessed': function (err, stat) {
     assert.isNull   (err);        //We have no error
     assert.isObject (stat);       //We have a stat object
  },
  'is not empty': function (err, stat) {
     assert.isNotZero (stat.size); //The file size is > 0
  }
}
V w
                          Parallel Execution

{ '/dev/stdout': {
     topic:    function   () { path.exists('/dev/stdout',this.callback) },
     'exists': function   (result) { assert.isTrue(result) }
  },
  '/dev/tty': {
     topic:    function   () { path.exists('/dev/tty',this.callback) },
     'exists': function   (result) { assert.isTrue(result) }
  },
  '/dev/null': {
     topic:    function   () { path.exists('/dev/null',this.callback) },
     'exists': function   (result) { assert.isTrue(result) }
  }
}
T Sw r
Permutation Explosion
T Sw r
Permutation Explosion
J v
      Really
J       M
Faster Test feedback


            Failures are not
            randomly distributed




            Lots of very short tests
            A few very long ones




                                   Kent Beck
J       M
Faster Test feedback
I         r     L
    Learn from Metrics
O   r             ff
        dessert
‘‘What is the use of a book,’’ thought Alice,
‘‘without pictures or conversations?’’

                                        Lewis Carroll
                   Alice’s Adventures in Wonderland
Sw       L
Words are not enough




                   Ward Cunningham
http://vimeo.com/22165070



                   Ward Cunningham
Gr p   T




           Brian Marick
‘‘How much do you know about the
           heuristics of failure?’

                                                    Joseph Wilk
                                        Scotland Ruby Conf 2011




http://testobsessed.com/wp-content/uploads/2007/02/testheuristicscheatsheetv1.pdf
T   I
Joseph Wilk
                             !
      @josephwilk
http://blog.josephwilk.net

Weitere ähnliche Inhalte

Was ist angesagt?

Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersBartosz Kosarzycki
 
High Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScriptHigh Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScriptLeonardo Borges
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokusHamletDRC
 
The algebra of library design
The algebra of library designThe algebra of library design
The algebra of library designLeonardo Borges
 
Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)HamletDRC
 
Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Arnaud Giuliani
 
Kotlin in action
Kotlin in actionKotlin in action
Kotlin in actionCiro Rizzo
 
Kotlin cheat sheet by ekito
Kotlin cheat sheet by ekitoKotlin cheat sheet by ekito
Kotlin cheat sheet by ekitoArnaud Giuliani
 
Gatling - Paris Perf User Group
Gatling - Paris Perf User GroupGatling - Paris Perf User Group
Gatling - Paris Perf User Groupslandelle
 
Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017Arnaud Giuliani
 
TMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart CastsTMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart CastsIosif Itkin
 
Bytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASMBytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASMashleypuls
 

Was ist angesagt? (20)

From dot net_to_rails
From dot net_to_railsFrom dot net_to_rails
From dot net_to_rails
 
Get your teeth into Plack
Get your teeth into PlackGet your teeth into Plack
Get your teeth into Plack
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developers
 
Smoking docker
Smoking dockerSmoking docker
Smoking docker
 
Getting Testy With Perl6
Getting Testy With Perl6Getting Testy With Perl6
Getting Testy With Perl6
 
Getting testy with Perl
Getting testy with PerlGetting testy with Perl
Getting testy with Perl
 
High Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScriptHigh Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScript
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
 
The algebra of library design
The algebra of library designThe algebra of library design
The algebra of library design
 
Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)
 
Testing untestable code - IPC12
Testing untestable code - IPC12Testing untestable code - IPC12
Testing untestable code - IPC12
 
Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017
 
Kotlin in action
Kotlin in actionKotlin in action
Kotlin in action
 
Effective Benchmarks
Effective BenchmarksEffective Benchmarks
Effective Benchmarks
 
Kotlin cheat sheet by ekito
Kotlin cheat sheet by ekitoKotlin cheat sheet by ekito
Kotlin cheat sheet by ekito
 
Gatling - Paris Perf User Group
Gatling - Paris Perf User GroupGatling - Paris Perf User Group
Gatling - Paris Perf User Group
 
Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017
 
TMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart CastsTMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart Casts
 
Bytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASMBytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASM
 
Unit Testing Lots of Perl
Unit Testing Lots of PerlUnit Testing Lots of Perl
Unit Testing Lots of Perl
 

Ähnlich wie Testing outside of the Ruby World

Basics of Javascript
Basics of JavascriptBasics of Javascript
Basics of JavascriptUniverse41
 
CoffeeScript-Ruby-Tuesday
CoffeeScript-Ruby-TuesdayCoffeeScript-Ruby-Tuesday
CoffeeScript-Ruby-TuesdayEddie Kao
 
A Lifecycle Of Code Under Test by Robert Fornal
A Lifecycle Of Code Under Test by Robert FornalA Lifecycle Of Code Under Test by Robert Fornal
A Lifecycle Of Code Under Test by Robert FornalQA or the Highway
 
Maintainable JavaScript
Maintainable JavaScriptMaintainable JavaScript
Maintainable JavaScriptNicholas Zakas
 
Anatomy of a Reactive Application
Anatomy of a Reactive ApplicationAnatomy of a Reactive Application
Anatomy of a Reactive ApplicationMark Wilson
 
Scala Programming for Semantic Web Developers ESWC Semdev2015
Scala Programming for Semantic Web Developers ESWC Semdev2015Scala Programming for Semantic Web Developers ESWC Semdev2015
Scala Programming for Semantic Web Developers ESWC Semdev2015Jean-Paul Calbimonte
 
Computational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in RComputational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in Rherbps10
 
Lagergren jvmls-2013-final
Lagergren jvmls-2013-finalLagergren jvmls-2013-final
Lagergren jvmls-2013-finalMarcus Lagergren
 
The $path to knowledge: What little it take to unit-test Perl.
The $path to knowledge: What little it take to unit-test Perl.The $path to knowledge: What little it take to unit-test Perl.
The $path to knowledge: What little it take to unit-test Perl.Workhorse Computing
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVMVaclav Pech
 
ScalaCheck
ScalaCheckScalaCheck
ScalaCheckBeScala
 
Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016Ben Lesh
 
Designing with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaDesigning with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaNaresha K
 
Advanced akka features
Advanced akka featuresAdvanced akka features
Advanced akka featuresGrzegorz Duda
 
How to not write a boring test in Golang
How to not write a boring test in GolangHow to not write a boring test in Golang
How to not write a boring test in GolangDan Tran
 

Ähnlich wie Testing outside of the Ruby World (20)

Basics of Javascript
Basics of JavascriptBasics of Javascript
Basics of Javascript
 
CoffeeScript-Ruby-Tuesday
CoffeeScript-Ruby-TuesdayCoffeeScript-Ruby-Tuesday
CoffeeScript-Ruby-Tuesday
 
A Lifecycle Of Code Under Test by Robert Fornal
A Lifecycle Of Code Under Test by Robert FornalA Lifecycle Of Code Under Test by Robert Fornal
A Lifecycle Of Code Under Test by Robert Fornal
 
Maintainable JavaScript
Maintainable JavaScriptMaintainable JavaScript
Maintainable JavaScript
 
Anatomy of a Reactive Application
Anatomy of a Reactive ApplicationAnatomy of a Reactive Application
Anatomy of a Reactive Application
 
Scala Programming for Semantic Web Developers ESWC Semdev2015
Scala Programming for Semantic Web Developers ESWC Semdev2015Scala Programming for Semantic Web Developers ESWC Semdev2015
Scala Programming for Semantic Web Developers ESWC Semdev2015
 
Computational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in RComputational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in R
 
Lagergren jvmls-2013-final
Lagergren jvmls-2013-finalLagergren jvmls-2013-final
Lagergren jvmls-2013-final
 
The $path to knowledge: What little it take to unit-test Perl.
The $path to knowledge: What little it take to unit-test Perl.The $path to knowledge: What little it take to unit-test Perl.
The $path to knowledge: What little it take to unit-test Perl.
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
 
Javascript status 2016
Javascript status 2016Javascript status 2016
Javascript status 2016
 
ScalaCheck
ScalaCheckScalaCheck
ScalaCheck
 
Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016
 
Designing with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaDesigning with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf India
 
IntroTestMore
IntroTestMoreIntroTestMore
IntroTestMore
 
IntroTestMore
IntroTestMoreIntroTestMore
IntroTestMore
 
Advanced akka features
Advanced akka featuresAdvanced akka features
Advanced akka features
 
How to not write a boring test in Golang
How to not write a boring test in GolangHow to not write a boring test in Golang
How to not write a boring test in Golang
 
Smalltalk on rubinius
Smalltalk on rubiniusSmalltalk on rubinius
Smalltalk on rubinius
 
Event Driven Javascript
Event Driven JavascriptEvent Driven Javascript
Event Driven Javascript
 

Mehr von Joseph Wilk

Acceptance testing in the land of the startup
Acceptance testing in the land of the startup Acceptance testing in the land of the startup
Acceptance testing in the land of the startup Joseph Wilk
 
Rubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talkRubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talkJoseph Wilk
 
The Limited Red Society
The Limited Red SocietyThe Limited Red Society
The Limited Red SocietyJoseph Wilk
 
The Limited Red Society
The Limited Red Society The Limited Red Society
The Limited Red Society Joseph Wilk
 
Rubyconf lightning talk
Rubyconf lightning talkRubyconf lightning talk
Rubyconf lightning talkJoseph Wilk
 
Acceptance testing in the land of the startup
Acceptance testing in the land of the startupAcceptance testing in the land of the startup
Acceptance testing in the land of the startupJoseph Wilk
 
Cucumber Patterns Workshop
Cucumber Patterns WorkshopCucumber Patterns Workshop
Cucumber Patterns WorkshopJoseph Wilk
 
Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled CucumbersJoseph Wilk
 
Cucumber Ru09 Web
Cucumber Ru09 WebCucumber Ru09 Web
Cucumber Ru09 WebJoseph Wilk
 
Dynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the StringsDynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the StringsJoseph Wilk
 
Outside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and RspecOutside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and RspecJoseph Wilk
 
Testing with Ruby
Testing with RubyTesting with Ruby
Testing with RubyJoseph Wilk
 

Mehr von Joseph Wilk (16)

Frozenrails2011
Frozenrails2011Frozenrails2011
Frozenrails2011
 
Acceptance testing in the land of the startup
Acceptance testing in the land of the startup Acceptance testing in the land of the startup
Acceptance testing in the land of the startup
 
Rubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talkRubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talk
 
The Limited Red Society
The Limited Red SocietyThe Limited Red Society
The Limited Red Society
 
The Limited Red Society
The Limited Red Society The Limited Red Society
The Limited Red Society
 
Spa2011
Spa2011Spa2011
Spa2011
 
Rubyconf lightning talk
Rubyconf lightning talkRubyconf lightning talk
Rubyconf lightning talk
 
Acceptance testing in the land of the startup
Acceptance testing in the land of the startupAcceptance testing in the land of the startup
Acceptance testing in the land of the startup
 
Cucumber Patterns Workshop
Cucumber Patterns WorkshopCucumber Patterns Workshop
Cucumber Patterns Workshop
 
Musichackday
MusichackdayMusichackday
Musichackday
 
Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled Cucumbers
 
Cucumber Ru09 Web
Cucumber Ru09 WebCucumber Ru09 Web
Cucumber Ru09 Web
 
Cucumbered
CucumberedCucumbered
Cucumbered
 
Dynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the StringsDynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the Strings
 
Outside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and RspecOutside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and Rspec
 
Testing with Ruby
Testing with RubyTesting with Ruby
Testing with Ruby
 

Kürzlich hochgeladen

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Kürzlich hochgeladen (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Testing outside of the Ruby World

  • 1. T O f Rb W r Joseph Wilk
  • 2. W ’ R b fr ?
  • 3. Sr ... N R b . R .
  • 4. “The number of languages you know corresponds to your programming skill” S
  • 5. Y ... T JUnit ScrewUnit Rspec JBehave PHPSpec Jasmine JSpec Cucumber Circumspec BlahSpec SomethingSpec WhateverSpec
  • 6. Y ... T JUnit ScrewUnit Rspec BORING! JBehave PHPSpec Jasmine JSpec Cucumber Circumspec BlahSpec SomethingSpec WhateverSpec
  • 7. T &M Ruby Monkey.stub!(:new).and_return(mock("monkey")) Java I owe you one Java mocking example. I don’t have the will power to write it. Sorry.
  • 8. T &M Ruby BORING! Monkey.stub!(:new).and_return(mock("monkey")) Java I owe you one Java mocking example. I don’t have the will power to write it. Sorry.
  • 9. I r Asynchronous Property testing Permutation Model testing explosions Metrics Test feedback Graphical tests
  • 10. H Curry
  • 11. “Program testing can be used to show the presence of bugs, but never to show their absence!” Edsger Dijkstra
  • 12. Q C Properties For all values of s the length of the thing returned by five_random_characters is 5
  • 13. Q C Properties QuickCheck Randomly Logic generate Function tests
  • 14. Q C Properties QuickCheck Randomly Logic generate Function tests
  • 15. Q C Properties QuickCheck Randomly Logic generate Function tests
  • 16. Q C Properties QuickCheck Randomly Logic generate Function tests
  • 17. Q C Properties QuickCheck Randomly Logic generate Function tests Counter Examples
  • 18. Q C Properties it "should reverse a string" do "monkeys".reverse.reverse.should == "monkeys" end 100.times.map {“#{rand(10)}#{rand(10)}”}.each do |char| it "should reverse a string" do char.reverse.reverse.should == char end end
  • 19. Q C Properties import Data.Char import Test.QuickCheck instance Arbitrary Char where arbitrary = choose ('32', '128') coarbitrary c = variant (ord c `rem` 4) prop_RevRev xs = reverse (reverse xs) == xs where types = xs::[Char] $ Main> quickCheck prop_RevRev OK, passed 100 tests.
  • 20. Er Messaging/ Concurrency
  • 21. M Er Models Erlang McErlang runtime runtime system system communication concurrency distribution
  • 22. M Er Models message Messenger “Scottish “Scottish Service fiction” fiction” Message login login Message client client Fred Clara
  • 23. M Er Models if user1 does not send a message m to user2 until user2 is logged on, then if user1 does send a message m to user2 then eventually user2 receives the message m. "not P until Q => (eventually P => eventually R)” P: clara sends message “Scottish fiction” to fred Q: fred is logged on R: fred receives the message “Scottish fiction” from clara
  • 24. M Er Models {program={scenario,start,[[ [{logon,clara},{message,fred,"hi"},logoff], [{logon,fred},logoff]]]}, monitor={mce_ltl_parse:ltl_string2module_and_load ("not P until Q implies (eventually P implies eventually R)", messenger_mon), {void,[{'P',basicPredicates:message_to (clara,fred,"hi")}, {'Q',basicPredicates:logon(fred)}, {'R',basicPredicates:message_received (fred,clara,"hi")}]}}, algorithm={mce_alg_buechi,void}}).
  • 25. “Every method you use to prevent or find bugs leaves a residue of subtler bugs against which those methods are ineffectual Pesticide Paradox / Beizer
  • 26. C r Bracket hell
  • 27. M Facts (fact  (alive-in-next-generation? ...cell...) => truthy    (provided     (alive? ...cell...) => false     (neighbor-count ...cell...) => 3)) cell = mock("a cell") cell.stub(:alive?).and_return(false) cell.stub(:neighbour_count).and_return(3) cell.alive_in_next_generation.should == true
  • 28. I Brief visit
  • 31. J v S rp Without the Java
  • 32. Z b . Trapped inside a browser
  • 33. Z b . Trapped inside a browser var zombie = require("zombie"); var assert = require("assert"); zombie.visit("http://localhost:3000/", function (err, browser, status) { browser. fill("email", "zombie@underworld.dead"). pressButton("Sign Me Up!", function(err, browser, status) { assert.equal(browser.text("title"), "Welcome"); }) });
  • 34. V w Topics { topic: function () { return 42 }, 'should be a number': function (topic) { assert.isNumber (topic); }, 'should be equal to 42': function (topic) { assert.equal (topic, 42); } }
  • 35. V w Asynchronous calls { topic: function () { fs.stat('~/FILE', this.callback); }, 'can be accessed': function (err, stat) { assert.isNull (err); // We have no error assert.isObject (stat); // We have a stat object }, 'is not empty': function (err, stat) { assert.isNotZero (stat.size); // The file size is > 0 } }
  • 36. V w Promises / Futures { topic: function () { var promise = new(events.EventEmitter); fs.stat('~/FILE', function (e, res) { if (e) { promise.emit('error', e) } else { promise.emit('success', res) } }); return promise; }, 'can be accessed': function (err, stat) { assert.isNull (err); //We have no error assert.isObject (stat); //We have a stat object }, 'is not empty': function (err, stat) { assert.isNotZero (stat.size); //The file size is > 0 } }
  • 37. V w Parallel Execution { '/dev/stdout': { topic: function () { path.exists('/dev/stdout',this.callback) }, 'exists': function (result) { assert.isTrue(result) } }, '/dev/tty': { topic: function () { path.exists('/dev/tty',this.callback) }, 'exists': function (result) { assert.isTrue(result) } }, '/dev/null': { topic: function () { path.exists('/dev/null',this.callback) }, 'exists': function (result) { assert.isTrue(result) } } }
  • 38. T Sw r Permutation Explosion
  • 39. T Sw r Permutation Explosion
  • 40. J v Really
  • 41. J M Faster Test feedback Failures are not randomly distributed Lots of very short tests A few very long ones Kent Beck
  • 42. J M Faster Test feedback
  • 43. I r L Learn from Metrics
  • 44. O r ff dessert
  • 45. ‘‘What is the use of a book,’’ thought Alice, ‘‘without pictures or conversations?’’ Lewis Carroll Alice’s Adventures in Wonderland
  • 46. Sw L Words are not enough Ward Cunningham
  • 47. http://vimeo.com/22165070 Ward Cunningham
  • 48. Gr p T Brian Marick
  • 49. ‘‘How much do you know about the heuristics of failure?’ Joseph Wilk Scotland Ruby Conf 2011 http://testobsessed.com/wp-content/uploads/2007/02/testheuristicscheatsheetv1.pdf
  • 50. T I
  • 51. Joseph Wilk ! @josephwilk http://blog.josephwilk.net