Unit Testing

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Unit Testing - Presentation Transcript

    1. Unit Testing is for Weenies. Important lessons learned from being a bullheaded developer...
    2. Unit Testing 101 What are these units and why do they need testing?
    3. What is Unit Testing? In computer programming, unit testing is a soft ware verification and validation method where the programmer gains confidence that individual units of source code are fit for use. A unit is the smallest testable part of an application. In procedural programming a unit may be an individual program, function, procedure, etc., while in object-oriented programming, the smallest unit is a method, which may belong to a base/super class, abstract class or derived/child class. http://en.wikipedia.org/wiki/Unit_testing
    4. No, really. What is Unit Testing...?
    5. Assertion Testing IF the assertion fails, THEN display an error message...
    6. Why should we test? To ensure repeatability of desired behaviors To identify and remove undesired behaviors To provide specifications for expected behavior
    7. Why should I spend time testing my code? How do you know that it works, particularly if it’s part of a big system? How do you know which part is broken when it breaks? How do you know that you know which part is broken?
    8. There just isn’t enough time for testing! How much time do we spend... Debugging a script or application? Finding the actual bug? How many billable hours do we lose? !?! Don’t we make our own schedules?
    9. I always test my code... $newThing = new Thing(); $newThing->doSomething(); $newThing->doSomething($else); if ( $newThing->something == $else ) { echo “All done!” }
    10. I always test my code... How can anyone ever repeat that test? What did it test, anyway? What do you have to show for the effort?
    11. How should we test? With the least amount of required human inter vention In a manner that is reliably repeatable, AKA “precise” In a manner that demonstrates desirable behavior, AKA “ accurate”
    12. No, really. HOW?
    13. How to Perform Unit Tests on Objects
    14. 1. Pick a test fixture... 2. Start writing tests... 3. Run your tests... 4. Repeat until done...
    15. Gee, Thanks. How about an example?
    16. Doesn’t that seem repetitive? I’m glad you asked...
    17. Testing is so repetitive...
    18. Testing is so repetitive... Unit Tests test Objects. Objects have Inheritance. Unit Tests are themselves Objects. Don’t Repeat Yourself.
    19. How to Sell Your Boss on Unit Testing It’s not me, it’s the psycho I work for...
    20. The Essence of Quality Control is Testing Testing adds value to work and products Lessons from other industries... Toyota makes Good Automobiles. Sam Adams makes Good Beer. Unit Testing is Quality Control.
    21. Quality Control Testing MUST BE Rigorous, by testing everything, Repeatable, via automated tests, Producible upon demand, Rigorous, repeatable, producible tests generate a more stable code base and a more accountable project.
    22. Testing actually saves time and money Spend less time on tail-end debugging and finding those bugs, Expose logical flaws and assumptions that we all unintentionally build on, Build dependencies that work since they’re based on proven assumptions.
    23. Topics to ask Google and Wikipedia about... JUnit - The granddaddy of ‘em all. phpUnit - My torture chamber of choice. RSpec - Unit Testing for Ruby. Selenium - Graphical Unit Testing. Test-Driven Development - Way of Life.
    24. Who is this guy? linkedin.com/in/althex t witter.com/al_the_x ethos-development.com David Rogers orlandophp.org

    + David RogersDavid Rogers, 3 weeks ago

    custom

    111 views, 0 favs, 0 embeds more stats

    There's no shortage of cowboy code-slingers out the more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 111
      • 111 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 3
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories