Dismiss Notice
You are browsing this site as a guest. It takes 2 minutes to CREATE AN ACCOUNT and less than 1 minute to LOGIN

Introduction to TDD with PHPUnit

Discussion in 'Tech, Gadgets & Science Forum' started by emanuel.feruzi, Nov 29, 2009.

  1. emanuel.feruzi

    emanuel.feruzi Senior Member

    #1
    Nov 29, 2009
    Joined: Apr 25, 2009
    Messages: 103
    Likes Received: 3
    Trophy Points: 0
    Hi,

    I have been working on a small tool called kiGM for the ANLoc initiative and as I wanted to know how it will behave in different scenarios. There is no better way to do that than to use Test Driven Development. So after a few how of programming I thought someone might be wondering how to do TDD on PHP. So I blogged it with a very simple example.

    An Extract from the Post:

    TDD Example with PHP
    There are many ways in which one can implement a TDD. In this example, we will create a simple calculator with the four basic operations that is (add, subtract, multiply and divide).
    But after looking around and looking back to my exprience, it looks like there is one way that most developers agree on:-
    • design your class/API
    • create a test suite
    • run the test, and in this case all tests should fail
    • implement the class
    • run the test, an this time some test will pass and some will fail
    • fix failures or errors
    • repeat 5 and 6 till all tests have passed

    Lets get to it......

    Read and get complete source code.
     
Loading...