Open source bridge testing antipatterns presentation
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Open source bridge testing antipatterns presentation

on

  • 754 views

These are the slides for the presentation I gave on antipatterns used in testing. This was at Open Source Bridge in June of 2011.

These are the slides for the presentation I gave on antipatterns used in testing. This was at Open Source Bridge in June of 2011.

Statistics

Views

Total Views
754
Views on SlideShare
640
Embed Views
114

Actions

Likes
0
Downloads
4
Comments
0

1 Embed 114

http://www.mattrobinson.net 114

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Ask questions whenever you want
  • Talk about Design Patterns general reusable solution to a commonly occurring problem
  • Realized while writing this talk that I was focusing on what pissed me off and made me not want to talk about it. Should be humor in testing.
  • Red failing Green passing
  • Not really an antipattern since it’s really only solving being lazy
  • CI essentially glorified cron job
  • The Joel Test #5: Fix bugs before writing new code Mention Lava Lamps
  • Martin Fowler Mocks aren't Stubs. Never met a mockist whose tests I liked. Not mocking means mini integration tests. Possibly controversial. When to mock: code you don't control - file system, web server, external libraries like ssl
  • Too much mocking might indicate this
  • Everyone has their own terms
  • Test Driven Development prevents this
  • Behaviour Driven Development is a larger term with more meaning
  • These are annoying but can’t be ignored. How to find these failures - binary search.
  • Testing antipatterns can indicate antipatterns in your implementation code
  • Data driven web apps tend to be even worse

Open source bridge testing antipatterns presentation Presentation Transcript

  • 1. Testing Antipatterns
    • Matt Robinson
    • Puppet Labs
  • 2. Anti - What?
  • 3. Antipattern ( Dark Pattern ):
    • A pattern that is commonly used but is ineffective and/or counterproductive
  • 4.  
  • 5. Who has an extensive test suite?
  • 6. Who feels like they should test more?
  • 7. Who dislikes, even dreads, writing tests?
  • 8. Testing Can Be Fun Text Text Text Text http://xkcd.com/583/
  • 9. For example:
  • 10. Red Green TDD Addiction
  • 11. Testing Framework Games (although these can be a distraction) (although these can be a distraction)
  • 12. Not looking like an idiot - that’s fun right?
  • 13. Why Automated Testing?
    • Prevents regressions
    • Improves confidence
    • Documents requirements
    • Catches errors before codes ships
    • You fill in the blank _________
  • 14. Overheard Reasons Not to Test
    • Don’t trust the tests
    • Who tests the tests? Quis custodiet ipsos custodes?
    • Makes refactoring harder
    • Not enough return on investment (ROI)
    • Too hard and/or time consuming
  • 15. Antipatterns that have bitten me the most
  • 16. Not Running Tests Often Enough
  • 17. If it’s Hard and Important Do it More Often
  • 18. testing, deploying, releasing, exercising, meditating, writing, public speaking
  • 19. How Often?
    • Before deployment or release
    • After every commit: CI (Continuous Integration) - Jenkins, Cruise Control, BuildBot, Cerebrus, CI Joe
    • Before every commit (or push): discipline, git hooks
    • Every save: autotest, watchr
  • 20. Not Fixing Broken Tests Before Committing New Code
  • 21. The Slowpoke
  • 22. How Slow Is Too Slow?
  • 23. Unit Test Suite Took 8 Hours to Run - On One Project
  • 24. Single Test Took 2 Minutes to Start
  • 25. So slow that rewriting it in PHP would make it faster
  • 26. How to Get Faster
    • Make your implementation code faster
    • Run your tests in parallel
    • Optimize your tests (new framework, trick garbage collector, rewrite culprits)
    • Mark some tests as slow and only run them occasionally
  • 27. The Mockery
  • 28. Why mock when the real things will do?
  • 29. Testing at the Wrong Level
  • 30. unit, smoke, functional, integration, acceptance
  • 31. Success Against All Odds (test never fails) (test never fails)
  • 32.  
  • 33. Testing Implementation Instead of Behavior
  • 34. Testing Implementation
  • 35. Testing Behavior
  • 36. Order Dependent Failures
  • 37. You’ve got too much global state
  • 38. Excessive Setup
  • 39. What are we testing again?
  • 40.
    • The Dodger - Never tests desired behavior
    • The Stranger - Misplaced tests
    • Local Hero - Worked on my dev box
    • Generous Leftovers - Fills your hard drive
    • The Giant - You may have a God object
    • The Loudmouth - Spams your test logs
    Other Antipatterns
  • 41. Summary
  • 42. Avoid Antipatterns and Testing Can Be Fun
  • 43. Links
    • http://blog.james-carr.org/2006/11/03/tdd-anti-patterns/
    • http://jasonrudolph.com/blog/testing-anti-patterns-how-to-fail-with-100-test-coverage/
    • http://blog.rubybestpractices.com/posts/gregory/034-issue-5-testing-antipatterns.html
    • http://c2.com/cgi/wiki?AntiPatternsCatalog
    • http://martinfowler.com/articles/mocksArentStubs.html