SlideShare uma empresa Scribd logo
1 de 24
Perils of Testing and
Perils of not testing
      A few anecdotes
David Dorward
   twitter @dorward
   CPAN DORWARD
   WWW http://dorward.me.uk
Testing
Why test?
Why test?

To make sure code does what it should do
Why test?

To make sure code does what it should do
To make sure code continues to do what it should do
Why test?

To make sure code does what it should do
To make sure code continues to do what it should do
To communicate what code should do
Knowing your subject
Perils of Tests
15:22 < t0m> Dorward: well volunteered, what was your CPAN id again?
15:23 < Dorward> Eeek
15:23 < Dorward> What have I done?!
15:23 < Penfold> made it better
15:23 < Penfold> be porud
15:23 <+mdk> t0m: nice one ++
15:23 < t0m> Made DORWARD primary maintainer of
Catalyst::View::ContentNegotiation::XHTML.
15:23 < t0m> Made DORWARD primary maintainer of
Catalyst::View::TT::XHTML.
So who needs tests?
So who needs tests?

Me: Can you merge this patch? It might need tweaking, I’m
not an expert in that framework.
So who needs tests?

Me: Can you merge this patch? It might need tweaking, I’m
not an expert in that framework.
Alice: Sure, we’ll tweak it.
So who needs tests?

Me: Can you merge this patch? It might need tweaking, I’m
not an expert in that framework.
Alice: Sure, we’ll tweak it.
Me: Hang on, it only works for the top level directory!
So who needs tests?

Me: Can you merge this patch? It might need tweaking, I’m
not an expert in that framework.
Alice: Sure, we’ll tweak it.
Me: Hang on, it only works for the top level directory!
Bob: It passes the tests that Alice wrote though…
Tests help developers
    communicate
…with each other
BDD
Behaviour Driven
  Development
Scenarios

Given
When
Then
For example

Given a program that started at 1800 yesterday on BBC One
When the iPlayer homepage is loaded
Then that program is show at the top of the schedule
Business
     Reqs
                           Designs

                                            UXD




                 BA

                                 Feedback

               Scenario
                Design
               Meetings
     Testing              Dev




Who creates scenarios?
Benefits

Everyone knows what everyone else means
Challenge requirements
Spot edge cases
When you do start coding, you can just get on with it
BA




                   Scenario
                    Design
                   Meetings
         Testing               Dev




Manual                               Automated
                   Scenarios
 Tests                                 Tests




         Artefacts
TDD

Mais conteúdo relacionado

Destaque

Βάσεις δεδομένων Κεφ.1
Βάσεις δεδομένων Κεφ.1Βάσεις δεδομένων Κεφ.1
Βάσεις δεδομένων Κεφ.1marygeorg
 
Adjectives main class
Adjectives main classAdjectives main class
Adjectives main classlsaezmansilla
 
Βάσεις Δεδομένων Κεφ3
Βάσεις Δεδομένων Κεφ3Βάσεις Δεδομένων Κεφ3
Βάσεις Δεδομένων Κεφ3marygeorg
 
βάσεις δεδομένων κεφ2
βάσεις δεδομένων κεφ2βάσεις δεδομένων κεφ2
βάσεις δεδομένων κεφ2marygeorg
 
De private holding anno 2012 - patrimoniale en fiscale optimalisatie na het r...
De private holding anno 2012 - patrimoniale en fiscale optimalisatie na het r...De private holding anno 2012 - patrimoniale en fiscale optimalisatie na het r...
De private holding anno 2012 - patrimoniale en fiscale optimalisatie na het r...Lexalert
 
Investigacion etnografica
Investigacion etnograficaInvestigacion etnografica
Investigacion etnograficalilianatarapues
 
Jonathan Edwards powerpoint 2010
Jonathan Edwards powerpoint 2010Jonathan Edwards powerpoint 2010
Jonathan Edwards powerpoint 2010Amber Phelps
 
La 2 república
La 2 repúblicaLa 2 república
La 2 repúblicajaccbatxart
 

Destaque (11)

Βάσεις δεδομένων Κεφ.1
Βάσεις δεδομένων Κεφ.1Βάσεις δεδομένων Κεφ.1
Βάσεις δεδομένων Κεφ.1
 
Adjectives main class
Adjectives main classAdjectives main class
Adjectives main class
 
Βάσεις Δεδομένων Κεφ3
Βάσεις Δεδομένων Κεφ3Βάσεις Δεδομένων Κεφ3
Βάσεις Δεδομένων Κεφ3
 
βάσεις δεδομένων κεφ2
βάσεις δεδομένων κεφ2βάσεις δεδομένων κεφ2
βάσεις δεδομένων κεφ2
 
De private holding anno 2012 - patrimoniale en fiscale optimalisatie na het r...
De private holding anno 2012 - patrimoniale en fiscale optimalisatie na het r...De private holding anno 2012 - patrimoniale en fiscale optimalisatie na het r...
De private holding anno 2012 - patrimoniale en fiscale optimalisatie na het r...
 
I have to...
I have to...I have to...
I have to...
 
Fafsaws01bw
Fafsaws01bwFafsaws01bw
Fafsaws01bw
 
Investigacion etnografica
Investigacion etnograficaInvestigacion etnografica
Investigacion etnografica
 
G6 Pd Presentation
G6 Pd PresentationG6 Pd Presentation
G6 Pd Presentation
 
Jonathan Edwards powerpoint 2010
Jonathan Edwards powerpoint 2010Jonathan Edwards powerpoint 2010
Jonathan Edwards powerpoint 2010
 
La 2 república
La 2 repúblicaLa 2 república
La 2 república
 

Último

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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

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)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 

Perils of testing

  • 1. Perils of Testing and Perils of not testing A few anecdotes
  • 2. David Dorward twitter @dorward CPAN DORWARD WWW http://dorward.me.uk
  • 5. Why test? To make sure code does what it should do
  • 6. Why test? To make sure code does what it should do To make sure code continues to do what it should do
  • 7. Why test? To make sure code does what it should do To make sure code continues to do what it should do To communicate what code should do
  • 9. Perils of Tests 15:22 < t0m> Dorward: well volunteered, what was your CPAN id again? 15:23 < Dorward> Eeek 15:23 < Dorward> What have I done?! 15:23 < Penfold> made it better 15:23 < Penfold> be porud 15:23 <+mdk> t0m: nice one ++ 15:23 < t0m> Made DORWARD primary maintainer of Catalyst::View::ContentNegotiation::XHTML. 15:23 < t0m> Made DORWARD primary maintainer of Catalyst::View::TT::XHTML.
  • 10. So who needs tests?
  • 11. So who needs tests? Me: Can you merge this patch? It might need tweaking, I’m not an expert in that framework.
  • 12. So who needs tests? Me: Can you merge this patch? It might need tweaking, I’m not an expert in that framework. Alice: Sure, we’ll tweak it.
  • 13. So who needs tests? Me: Can you merge this patch? It might need tweaking, I’m not an expert in that framework. Alice: Sure, we’ll tweak it. Me: Hang on, it only works for the top level directory!
  • 14. So who needs tests? Me: Can you merge this patch? It might need tweaking, I’m not an expert in that framework. Alice: Sure, we’ll tweak it. Me: Hang on, it only works for the top level directory! Bob: It passes the tests that Alice wrote though…
  • 15. Tests help developers communicate
  • 17. BDD
  • 18. Behaviour Driven Development
  • 20. For example Given a program that started at 1800 yesterday on BBC One When the iPlayer homepage is loaded Then that program is show at the top of the schedule
  • 21. Business Reqs Designs UXD BA Feedback Scenario Design Meetings Testing Dev Who creates scenarios?
  • 22. Benefits Everyone knows what everyone else means Challenge requirements Spot edge cases When you do start coding, you can just get on with it
  • 23. BA Scenario Design Meetings Testing Dev Manual Automated Scenarios Tests Tests Artefacts
  • 24. TDD

Notas do Editor

  1. \n\n
  2. \n\n
  3. I&amp;#x2019;ve been spending the last year writing lots and lots of JavaScript and almost no Perl. Which gave me some trouble coming up with a talk for LPW! So let&amp;#x2019;s go for generic programmer material and talk about\n
  4. I&amp;#x2019;m going to talk about that oh so thrilling subject of testing.\n
  5. So, why do we test?\nTo make sure code does what it should do? That&amp;#x2019;s a bit obvious.\nHow about Regression testing? Ditto.\nLet&amp;#x2019;s talk communication. Tests are a way for developers to communicate.\nI promised anecdotes, didn&amp;#x2019;t I? Let&amp;#x2019;s start with one about&amp;#x2026;\n
  6. &amp;#x2026;Knowing your subject. I&amp;#x2019;ve spent quite a lot of time learning about exciting things like HTML, XHTML and content negotiation. Which led me to spotting a couple of limitations with the way a module that dealt with that sort of thing worked. IRC not being the best place to try to explain all the intricacies, I wrote some tests instead and the next thing I knew&amp;#x2026;\n
  7. &amp;#x2026; someone has decided that I knew too much about the domain and made me the module&amp;#x2019;s maintainer. Whoops.\n
  8. I wrote some code. It wasn&amp;#x2019;t very good, but it got the point across. \nOr so I thought. A week later the directory handling portion of the code didn&amp;#x2019;t work.\nIt did pass all the tests though, but since I was the only one involved who knew all the use cases, they didn&amp;#x2019;t cover all the requirements.\n
  9. \n\n
  10. &amp;#x2026;with each other. But what about non-developers?\n
  11. We&amp;#x2019;ve been experimenting with BDD. I love TLAs!\n
  12. This one stands for Business Driven Development, and we&amp;#x2019;re probably doing it wrong, but we are finding it helpful.\n
  13. The basic idea is to break down the requirements into small scenarios that describe preconditions, actions and outcomes &amp;#x2014; in plain English that everyone can understand. Developers, designers, managers, everyone.\n
  14. So a practical example, which I made up based on the main BBC iPlayer website (not a project I work on but one that many of you will recognise)\n
  15. There are issues with that example, but first there is the question of who writes them? Well, it doesn&amp;#x2019;t really matter who writes them down, the important thing is that they are a collaborative process. One of the benefits of scenarios is that they provide a focus for discussion. In our team, a couple of developers sit down with a tester and a business analyst and hammer out the scenarios together.\n
  16. Everyone knows what everyone else means. Discussions about requirements reduce problems such as a word having a different meaning to developers then it does to designers. Measure twice, cut once. There is little as boring as redoing a piece of work because the requirements were miscommunicated. \nA forum to challenge requirements; some of us have no problem shouting when we see a requirement or a design that doesn&amp;#x2019;t make sense, but this gives everyone a safe environment to raise those concerns. And it helps spot the edge cases as it gets every mind on the job. The program that starts at 1800 should be at the top? What if a program runs 1730 to 1830? What if the channel doesn&amp;#x2019;t broadcast at 6pm?\n
  17. And you get scenarios, which are basically tests written in plain English. But not just plain English, it is structured and therefore rather easier to translate into code for automated tests. The rest is just&amp;#x2026;\n
  18. \n\n