Tdd in php   a brief example
Upcoming SlideShare
Loading in...5
×
 

Tdd in php a brief example

on

  • 2,600 views

 

Statistics

Views

Total Views
2,600
Slideshare-icon Views on SlideShare
2,600
Embed Views
0

Actions

Likes
0
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

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

    Tdd in php   a brief example Tdd in php a brief example Presentation Transcript

    • TDD in PHP: A Brief Example
    • About Me Jeremy Kendall PHP Developer since 2001 Organizer Memphis PHP Contributor to FRAPI project (getfrapi.com) [email_address] @JeremyKendall http://jeremykendall.net
    • TDD in PHP: A Brief Example Test Driven Development, you say?
    • Frankly, my dear . . .
    • Why You Should Give A Damn
        Test Driven Development is perhaps one of the best and fastest ways to improve your understanding and command of object-oriented principles and best practices.
    • What is TDD?
      • From Wikipedia:
      • ” Test Driven Development (TDD) is a software development process that relies on the repetition of a very short development cycle . . .”
    • TDD Development Process
      • Write a test
      • Run all tests, watch new test fail
      • Write just enough code to make the test pass
      • Run all tests, watch new test pass
      • Lather, rinse, repeat . . .
      • Refactor
    • TDD: The Benefits
      • High cohesion, loose coupling
      • Confidence
      • Faster time to resolution
      • Documentation
    • TDD: The Drawbacks
      • Tests only cover what you think should be tested
      • False sense of confidence
      • Without management and team buy-in, TDD is DOA
    • TDD: Live Code Example
        Live Coding? Really? Why?
    • TDD: Live Code Example
      • Code example will test a integer calculator for a fictional Math Tutor application
      • Requirements
        • Will add one integer to another
        • Throws exceptions in the following cases:
          • Non-integer arguments provided
          • Integer overflow
          • Integer underflow
    • TDD: Live Code Example
      • We'll be using PHPUnit
      • PHPUnit will be configured with phpunit.xml
      • phpunit.xml:
        • Calls bootstrap.php
        • Tells PHPUnit where to look for our tests
        • Code coverage and testdox reports
      • bootstrap.php:
        • Adds our library to the include path
        • Registers a simple autoloader
    • TDD: Live Code Example
      • Design Decisions
        • PEAR naming convention
        • Interface, not implementation
        • Interface: Tutor_Calculator_Interface
        • Implementation: Tutor_Calculator_IntegerCalculator
    • LET'S GET IT ON!
    • Resources
      • Test Driven Development at Wikipedia - http://bit.ly/9Aa3Xr
      • PHPUnit - http://www.phpunit.de/
      • Xdebug - http://www.xdebug.org/
      • The code example in this presentation was adapted for PHP from Przemysław Bielicki's TDD video tutorial at Agile Software Development. - http://bit.ly/byDZOA
    • Thanks!
        [email_address] @JeremyKendall http://jeremykendall.net