Your SlideShare is downloading. ×
0
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Unit Testing Your Application
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Unit Testing Your Application

988

Published on

From a Joomla Day Midwest presentation, this focuses on unit testing in the open source Joomla project. The slides wrap around two demonstrations that cannot be included here.

From a Joomla Day Midwest presentation, this focuses on unit testing in the open source Joomla project. The slides wrap around two demonstrations that cannot be included here.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
988
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Breaking your application up into chunks (units) and ensuring each unit does what it is supposed to do.\n
  • Typically a single class, because classes are the smallest independent pieces of your application.\n
  • Typically with a "test harness," a body of code that will call the unit under test and check the results it gets back against a predicted value.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. What is Unit Testing?
    • 2. What is Unit Testing?Breaking an application up into chunks (units) and testing each unit individually.
    • 3. Whats a “unit”?
    • 4. Whats a “unit”? Typically a single class, because classes are thesmallest independent pieces of your application.
    • 5. How do I test it?
    • 6. How do I test it? With a “test harness.” (code that calls the unit being tested andcompares the results to a predicted value)
    • 7. Why Should I Unit Test?
    • 8. Why Should I Unit Test?• Quality
    • 9. Why Should I Unit Test?• Quality • No amount of testing has ever put quality into a product
    • 10. Why Should I Unit Test?• Quality • No amount of testing has ever put quality into a product• Explore unknown code
    • 11. Why Should I Unit Test?• Quality • No amount of testing has ever put quality into a product• Explore unknown code • "What happens if I poke it here?"
    • 12. Why Should I Unit Test?• Quality • No amount of testing has ever put quality into a product• Explore unknown code • "What happens if I poke it here?"• Reveal misunderstandings
    • 13. Why Should I Unit Test?• Quality • No amount of testing has ever put quality into a product• Explore unknown code • "What happens if I poke it here?"• Reveal misunderstandings• Confidence
    • 14. When Should I Write Unit Tests?
    • 15. When Should I Write Unit Tests?• Before writing new code
    • 16. When Should I Write Unit Tests?• Before writing new code• To illustrate a bug in existing code
    • 17. When Should I Write Unit Tests?• Before writing new code• To illustrate a bug in existing code• Before trying to refactor untested code
    • 18. PHPUnit
    • 19. PHPUnit• PHP version of xUnit testing system
    • 20. PHPUnit• PHP version of xUnit testing system• Standard testing harness for Joomla
    • 21. PHPUnit• PHP version of xUnit testing system• Standard testing harness for Joomla• Code: http://www.phpunit.de/
    • 22. PHPUnit• PHP version of xUnit testing system• Standard testing harness for Joomla• Code: http://www.phpunit.de/• Manual: http://www.phpunit.de/manual/ current/en/index.html
    • 23. PHPunit Tests
    • 24. PHPunit Tests• Test suite files: "...Test.php"
    • 25. PHPunit Tests• Test suite files: "...Test.php"• Testing methods: "test...()"
    • 26. PHPUnit Testing Procedure
    • 27. PHPUnit Testing Procedure • Instantiate class
    • 28. PHPUnit Testing Procedure • Instantiate class • Execute method
    • 29. PHPUnit Testing Procedure • Instantiate class • Execute method • Assert results
    • 30. Testing Assertions
    • 31. Testing Assertions• Locate Failures Easily
    • 32. Testing Assertions• Locate Failures Easily • Separate tests
    • 33. Testing Assertions• Locate Failures Easily • Separate tests • Detailed message
    • 34. Legacy code
    • 35. Legacy code• Code that has no unit tests
    • 36. Legacy code• Code that has no unit tests • Cannot be trusted
    • 37. Exploring Legacy code
    • 38. Exploring Legacy code• Discover actual functionality
    • 39. Exploring Legacy code• Discover actual functionality• Discover new bugs
    • 40. Exploring Legacy code• Discover actual functionality• Discover new bugs• Prepare for any code changes
    • 41. JObservable/JObserver
    • 42. Developing new code
    • 43. Developing new code Write Tests First!!
    • 44. Before I write code?? Why?
    • 45. Before I write code?? Why?• Small steps toward a solution
    • 46. Before I write code?? Why?• Small steps toward a solution • Focus your mind
    • 47. Before I write code?? Why?• Small steps toward a solution • Focus your mind • Encourage simpler code
    • 48. Before I write code?? Why?• Small steps toward a solution • Focus your mind • Encourage simpler code • No more code than necessary
    • 49. Before I write code?? Why?• Small steps toward a solution • Focus your mind • Encourage simpler code • No more code than necessary • Actually works
    • 50. Can I Improve JObservable?
    • 51. Can I Improve JObservable?• Notifies the observers
    • 52. Can I Improve JObservable?• Notifies the observers• Maintains 2 different lists
    • 53. Can I Improve JObservable?• Notifies the observers• Maintains 2 different lists• Single Responsibility Principle
    • 54. Can I Improve JObservable?• Notifies the observers• Maintains 2 different lists• Single Responsibility Principle • "Every class should have one and only one responsibility"
    • 55. JObserverList
    • 56. Arlen Walkeremail: Arlen.Walker@gmail.comTwitter: @Arlengithub: http://github.com/Paladinslideshare: http://www.slideshare.net/paladinwebservicesspeakerdeck: http://speakerdeck.com/u/paladinspkr8: http://speakerrate.com/speakers/7896-arlen

    ×