SlideShare a Scribd company logo
1 of 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

More Related Content

Similar to 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 to 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
 

More from 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
 

More from 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
 

Recently uploaded

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Recently uploaded (20)

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 

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