SlideShare una empresa de Scribd logo
1 de 43
Are Your Tests REALLY
     Helping?




Sunday, October 9, 2011
Motivation
           Why do we test, anyway?




Sunday, October 9, 2011
Bad Motivation




Sunday, October 9, 2011
Bad Motivation


                    • “My boss told me to”




Sunday, October 9, 2011
Bad Motivation


                    • “My boss told me to”
                    • “I’m a completist”




Sunday, October 9, 2011
Bad Motivation


                    • “My boss told me to”
                    • “I’m a completist”
                    • “I   Test Frameworks”




Sunday, October 9, 2011
Correct Motivation




Sunday, October 9, 2011
Correct Motivation


                    • Verify Correctness




Sunday, October 9, 2011
Correct Motivation


                    • Verify Correctness
                    • Gain Confidence




Sunday, October 9, 2011
Correct Motivation


                    • Verify Correctness
                    • Gain Confidence
                    • Communication




Sunday, October 9, 2011
Test Types
                          Vocabulary Break!




Sunday, October 9, 2011
Functional Tests


                          Does the overall
                          product satisfy the
                          the requirements?




Sunday, October 9, 2011
Integration Tests


                          Do the pieces fit
                          together?




Sunday, October 9, 2011
Unit Tests


                          Is the logic correct in
                          that function?




Sunday, October 9, 2011
Functional
             Understand the product.




Sunday, October 9, 2011
The Tools




Sunday, October 9, 2011
The Tools


                    • BeHat (Cucumber)




Sunday, October 9, 2011
The Tools


                    • BeHat (Cucumber)
                    • PHPSpec




Sunday, October 9, 2011
The Tools


                    • BeHat (Cucumber)
                    • PHPSpec
                    • Keyboard, Mouse, and You




Sunday, October 9, 2011
When Do They Work?

                    • During prototyping
                    • Focused on the product requirements
                    • Refactoring
                    • Regression of key features
                    • Better for smaller teams


Sunday, October 9, 2011
...Stop Helping?


                    • Focused on the implementation
                    • Rapidly changing functionality
                    • Large organizations




Sunday, October 9, 2011
Unit Tests
              Simple and to the point.




Sunday, October 9, 2011
Verify Correctness


                    • Line coverage
                    • Branch coverage
                    • Icky Bits-o-Logic




Sunday, October 9, 2011
Gain Confidence

                    • Individual functions
                    • Variety of parameters
                    • Works for expected interactions with
                      collaborators




Sunday, October 9, 2011
Communication

                    • Show how to use the function
                    • Show expected interactions with other
                      collaborators
                    • Increase discoverability of possible
                      reuse



Sunday, October 9, 2011
PHPUnit Standard



Sunday, October 9, 2011
Naming

                    • Pick a directory just for tests
                    • Pick a test file name suffix, ie. Test.php
                    • Match the name of the test file to the
                      name of the file being tested




Sunday, October 9, 2011
Classes

                    • One class per test file
                    • Name should match the file name
                    • Extend only tested TestCase classes
                    • No interfaces or abstract classes



Sunday, October 9, 2011
Functions
                    • No private functions
                    • Protected methods are reserved for
                      overriding parent methods
                    • Only provider and test methods are
                      allowed
                    • Make sure your provider and test
                      methods are public

Sunday, October 9, 2011
Control Structures



                    • There should be NO control structures




Sunday, October 9, 2011
PHPUnit Code Standard
                •         AllowedFunctionOverride
                •         ClassName
                •         ExtraneousClass
                •         FilenameSuffix
                •         NoInterfaces
                •         NoPrivateMethods
                •         ProvenTestCase
                •         TestOrProviderFunctionsOnly
                •         TestOrProviderIsPublic
                •         UnusedProvider

Sunday, October 9, 2011
PHP_CodeSniffer


                • CyclomaticComplexity (maximum of 1)
                • NestingLevel (maximum of 0)
                • UnnecessaryOverride




Sunday, October 9, 2011
PHP_CodeSniffer


                          Standard Available at:
                          http://github.com/elblinkin/
                          PHPUnit-CodeSniffer




Sunday, October 9, 2011
Save Time


                    • Test code MTTI of 0
                    • Reduce the connascence
                    • Scales with growing development team




Sunday, October 9, 2011
More...
                    • Ensure only one class is under test
                    • Avoid accessing globals
                          • Environment variables

                          • Configuration from disk

                    • Prevent interactions with external
                      resources
                    • Code Standard for Testability

Sunday, October 9, 2011
Integration
                          For everything in-between.




Sunday, October 9, 2011
You’re Paranoid

                    • Experimenting with third-party code or
                      service
                    • You do not trust that your collaborators
                      work as specified




Sunday, October 9, 2011
Save Time

                    • Save Time
                          • Discover integration issues early

                    • Waste of Time
                          • Time spent testing third-party code




Sunday, October 9, 2011
Warning


                    • Use them for experimentation
                    • Consider an alert instead
                    • Do not inflict them on others




Sunday, October 9, 2011
Good or Bad?


                    • Mock         • Code Coverage
                    • Manual       • Automated
                    • Copy/Paste   • Reuse




Sunday, October 9, 2011
Review
                    • Functional Tests
                          • prototyping, early stage, small team

                    • Unit Tests
                          • can be too much for early stage

                          • scale with a growing team size and code base

                    • Integration Tests
                          • only because you are paranoid


Sunday, October 9, 2011
Other Test Types

                    • Performance Testing
                    • Load Testing
                    • Security Testing
                    • Monitoring
                    • Logging


Sunday, October 9, 2011
• Who Am I?
                          @elblinkin : Etsy, Inc.

                • Want More?
                          http://codeascraft.etsy.com

                          http://github.com/etsy

                          http://elblinkin.info




Sunday, October 9, 2011

Más contenido relacionado

Similar a Are Your Tests Really Helping You?

High quality iOS development
High quality iOS developmentHigh quality iOS development
High quality iOS developmentRobin Lu
 
Test Driven Sysadmin
Test Driven SysadminTest Driven Sysadmin
Test Driven Sysadminjohanku
 
Atlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide DeckAtlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide DeckAtlassian
 
Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)zeeg
 
PHPUnit & Continuous Integration: An Introduction
PHPUnit & Continuous Integration: An IntroductionPHPUnit & Continuous Integration: An Introduction
PHPUnit & Continuous Integration: An Introductionalexmace
 
Bonfire... How'd You Do That?! - AtlasCamp 2011
Bonfire... How'd You Do That?! - AtlasCamp 2011Bonfire... How'd You Do That?! - AtlasCamp 2011
Bonfire... How'd You Do That?! - AtlasCamp 2011Atlassian
 
Fred Spencer: Designing a Great UI
Fred Spencer: Designing a Great UIFred Spencer: Designing a Great UI
Fred Spencer: Designing a Great UIAxway Appcelerator
 
Infusion for the birds
Infusion for the birdsInfusion for the birds
Infusion for the birdscolinbdclark
 
Developers! Y U No Open Source Ur Code?
Developers! Y U No Open Source Ur Code?Developers! Y U No Open Source Ur Code?
Developers! Y U No Open Source Ur Code?Craig Marvelley
 
2010.10.30 steven sustaining tdd agile tour shenzhen
2010.10.30 steven sustaining tdd   agile tour shenzhen2010.10.30 steven sustaining tdd   agile tour shenzhen
2010.10.30 steven sustaining tdd agile tour shenzhenOdd-e
 
Monitoring is easy, why are we so bad at it presentation
Monitoring is easy, why are we so bad at it  presentationMonitoring is easy, why are we so bad at it  presentation
Monitoring is easy, why are we so bad at it presentationTheo Schlossnagle
 
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...Brian Huff
 
Practical Cloud Security
Practical Cloud SecurityPractical Cloud Security
Practical Cloud SecurityJason Chan
 
Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011) Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011) Leonardo Borges
 
Conquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSConquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSCaridy Patino
 
Puppet camp europe 2011 hackability
Puppet camp europe 2011   hackabilityPuppet camp europe 2011   hackability
Puppet camp europe 2011 hackabilityPuppet
 
Is this how you hate unit testing?
Is this how you hate unit testing?Is this how you hate unit testing?
Is this how you hate unit testing?Steven Mak
 
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJava EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJAX London
 

Similar a Are Your Tests Really Helping You? (20)

High quality iOS development
High quality iOS developmentHigh quality iOS development
High quality iOS development
 
Test Driven Sysadmin
Test Driven SysadminTest Driven Sysadmin
Test Driven Sysadmin
 
Atlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide DeckAtlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide Deck
 
Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)
 
PHPUnit & Continuous Integration: An Introduction
PHPUnit & Continuous Integration: An IntroductionPHPUnit & Continuous Integration: An Introduction
PHPUnit & Continuous Integration: An Introduction
 
Bonfire... How'd You Do That?! - AtlasCamp 2011
Bonfire... How'd You Do That?! - AtlasCamp 2011Bonfire... How'd You Do That?! - AtlasCamp 2011
Bonfire... How'd You Do That?! - AtlasCamp 2011
 
Fred Spencer: Designing a Great UI
Fred Spencer: Designing a Great UIFred Spencer: Designing a Great UI
Fred Spencer: Designing a Great UI
 
Infusion for the birds
Infusion for the birdsInfusion for the birds
Infusion for the birds
 
Developers! Y U No Open Source Ur Code?
Developers! Y U No Open Source Ur Code?Developers! Y U No Open Source Ur Code?
Developers! Y U No Open Source Ur Code?
 
2010.10.30 steven sustaining tdd agile tour shenzhen
2010.10.30 steven sustaining tdd   agile tour shenzhen2010.10.30 steven sustaining tdd   agile tour shenzhen
2010.10.30 steven sustaining tdd agile tour shenzhen
 
Monitoring is easy, why are we so bad at it presentation
Monitoring is easy, why are we so bad at it  presentationMonitoring is easy, why are we so bad at it  presentation
Monitoring is easy, why are we so bad at it presentation
 
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
 
Practical Cloud Security
Practical Cloud SecurityPractical Cloud Security
Practical Cloud Security
 
Extending rails
Extending railsExtending rails
Extending rails
 
Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011) Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011)
 
Caridy patino - node-js
Caridy patino - node-jsCaridy patino - node-js
Caridy patino - node-js
 
Conquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSConquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JS
 
Puppet camp europe 2011 hackability
Puppet camp europe 2011   hackabilityPuppet camp europe 2011   hackability
Puppet camp europe 2011 hackability
 
Is this how you hate unit testing?
Is this how you hate unit testing?Is this how you hate unit testing?
Is this how you hate unit testing?
 
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJava EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
 

Más de LB Denker

Testing and DevOps Culture: Lessons Learned
Testing and DevOps Culture: Lessons LearnedTesting and DevOps Culture: Lessons Learned
Testing and DevOps Culture: Lessons LearnedLB Denker
 
Php|tek '12 It's More Than Just Style
Php|tek '12  It's More Than Just StylePhp|tek '12  It's More Than Just Style
Php|tek '12 It's More Than Just StyleLB Denker
 
Developer testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing FanaticDeveloper testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing FanaticLB Denker
 
phpDay 2012: Scaling Communication via Continuous Integration
phpDay 2012: Scaling Communication via Continuous IntegrationphpDay 2012: Scaling Communication via Continuous Integration
phpDay 2012: Scaling Communication via Continuous IntegrationLB Denker
 
QC Merge 2012: Growing community
QC Merge 2012: Growing communityQC Merge 2012: Growing community
QC Merge 2012: Growing communityLB Denker
 
PHP UK Conference 2012: Scaling Communication via Continuous Integration
PHP UK Conference 2012: Scaling Communication via Continuous IntegrationPHP UK Conference 2012: Scaling Communication via Continuous Integration
PHP UK Conference 2012: Scaling Communication via Continuous IntegrationLB Denker
 
Php com con-2011
Php com con-2011Php com con-2011
Php com con-2011LB Denker
 

Más de LB Denker (7)

Testing and DevOps Culture: Lessons Learned
Testing and DevOps Culture: Lessons LearnedTesting and DevOps Culture: Lessons Learned
Testing and DevOps Culture: Lessons Learned
 
Php|tek '12 It's More Than Just Style
Php|tek '12  It's More Than Just StylePhp|tek '12  It's More Than Just Style
Php|tek '12 It's More Than Just Style
 
Developer testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing FanaticDeveloper testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing Fanatic
 
phpDay 2012: Scaling Communication via Continuous Integration
phpDay 2012: Scaling Communication via Continuous IntegrationphpDay 2012: Scaling Communication via Continuous Integration
phpDay 2012: Scaling Communication via Continuous Integration
 
QC Merge 2012: Growing community
QC Merge 2012: Growing communityQC Merge 2012: Growing community
QC Merge 2012: Growing community
 
PHP UK Conference 2012: Scaling Communication via Continuous Integration
PHP UK Conference 2012: Scaling Communication via Continuous IntegrationPHP UK Conference 2012: Scaling Communication via Continuous Integration
PHP UK Conference 2012: Scaling Communication via Continuous Integration
 
Php com con-2011
Php com con-2011Php com con-2011
Php com con-2011
 

Último

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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 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
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Último (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 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 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
 
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)
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

Are Your Tests Really Helping You?

  • 1. Are Your Tests REALLY Helping? Sunday, October 9, 2011
  • 2. Motivation Why do we test, anyway? Sunday, October 9, 2011
  • 4. Bad Motivation • “My boss told me to” Sunday, October 9, 2011
  • 5. Bad Motivation • “My boss told me to” • “I’m a completist” Sunday, October 9, 2011
  • 6. Bad Motivation • “My boss told me to” • “I’m a completist” • “I Test Frameworks” Sunday, October 9, 2011
  • 8. Correct Motivation • Verify Correctness Sunday, October 9, 2011
  • 9. Correct Motivation • Verify Correctness • Gain Confidence Sunday, October 9, 2011
  • 10. Correct Motivation • Verify Correctness • Gain Confidence • Communication Sunday, October 9, 2011
  • 11. Test Types Vocabulary Break! Sunday, October 9, 2011
  • 12. Functional Tests Does the overall product satisfy the the requirements? Sunday, October 9, 2011
  • 13. Integration Tests Do the pieces fit together? Sunday, October 9, 2011
  • 14. Unit Tests Is the logic correct in that function? Sunday, October 9, 2011
  • 15. Functional Understand the product. Sunday, October 9, 2011
  • 17. The Tools • BeHat (Cucumber) Sunday, October 9, 2011
  • 18. The Tools • BeHat (Cucumber) • PHPSpec Sunday, October 9, 2011
  • 19. The Tools • BeHat (Cucumber) • PHPSpec • Keyboard, Mouse, and You Sunday, October 9, 2011
  • 20. When Do They Work? • During prototyping • Focused on the product requirements • Refactoring • Regression of key features • Better for smaller teams Sunday, October 9, 2011
  • 21. ...Stop Helping? • Focused on the implementation • Rapidly changing functionality • Large organizations Sunday, October 9, 2011
  • 22. Unit Tests Simple and to the point. Sunday, October 9, 2011
  • 23. Verify Correctness • Line coverage • Branch coverage • Icky Bits-o-Logic Sunday, October 9, 2011
  • 24. Gain Confidence • Individual functions • Variety of parameters • Works for expected interactions with collaborators Sunday, October 9, 2011
  • 25. Communication • Show how to use the function • Show expected interactions with other collaborators • Increase discoverability of possible reuse Sunday, October 9, 2011
  • 27. Naming • Pick a directory just for tests • Pick a test file name suffix, ie. Test.php • Match the name of the test file to the name of the file being tested Sunday, October 9, 2011
  • 28. Classes • One class per test file • Name should match the file name • Extend only tested TestCase classes • No interfaces or abstract classes Sunday, October 9, 2011
  • 29. Functions • No private functions • Protected methods are reserved for overriding parent methods • Only provider and test methods are allowed • Make sure your provider and test methods are public Sunday, October 9, 2011
  • 30. Control Structures • There should be NO control structures Sunday, October 9, 2011
  • 31. PHPUnit Code Standard • AllowedFunctionOverride • ClassName • ExtraneousClass • FilenameSuffix • NoInterfaces • NoPrivateMethods • ProvenTestCase • TestOrProviderFunctionsOnly • TestOrProviderIsPublic • UnusedProvider Sunday, October 9, 2011
  • 32. PHP_CodeSniffer • CyclomaticComplexity (maximum of 1) • NestingLevel (maximum of 0) • UnnecessaryOverride Sunday, October 9, 2011
  • 33. PHP_CodeSniffer Standard Available at: http://github.com/elblinkin/ PHPUnit-CodeSniffer Sunday, October 9, 2011
  • 34. Save Time • Test code MTTI of 0 • Reduce the connascence • Scales with growing development team Sunday, October 9, 2011
  • 35. More... • Ensure only one class is under test • Avoid accessing globals • Environment variables • Configuration from disk • Prevent interactions with external resources • Code Standard for Testability Sunday, October 9, 2011
  • 36. Integration For everything in-between. Sunday, October 9, 2011
  • 37. You’re Paranoid • Experimenting with third-party code or service • You do not trust that your collaborators work as specified Sunday, October 9, 2011
  • 38. Save Time • Save Time • Discover integration issues early • Waste of Time • Time spent testing third-party code Sunday, October 9, 2011
  • 39. Warning • Use them for experimentation • Consider an alert instead • Do not inflict them on others Sunday, October 9, 2011
  • 40. Good or Bad? • Mock • Code Coverage • Manual • Automated • Copy/Paste • Reuse Sunday, October 9, 2011
  • 41. Review • Functional Tests • prototyping, early stage, small team • Unit Tests • can be too much for early stage • scale with a growing team size and code base • Integration Tests • only because you are paranoid Sunday, October 9, 2011
  • 42. Other Test Types • Performance Testing • Load Testing • Security Testing • Monitoring • Logging Sunday, October 9, 2011
  • 43. • Who Am I? @elblinkin : Etsy, Inc. • Want More? http://codeascraft.etsy.com http://github.com/etsy http://elblinkin.info Sunday, October 9, 2011