I Just Test-Drove My First Development

I’ve been hearing about the benefits of Test Driven Development (TDD) for awhile now, but have never taken the time to try it out with any of my own work.

That was until this past week.

The code that I work in with my job doesn’t really lend itself to TDD simply because it’s all straight-through procedural code. The few functions that do exist would only be able to be tested by checking the raw HTML that the emit against an expected result. It’s possible, but extremely tedious so we just avoid it completely.

Recently though, I had the opportunity to write some new code, a small module completely independent of any of our existing code. I decided to give TDD a shot and see how things went.

It took a bit to get PHPUnit up and running on my dev machine, but once I did things started to progress nicely. I stubbed out some of my initial functions and got my tests failing, it was pretty exciting in the way that playing with new tech usually is.

I’m by no means a TDD expert, but here’s some things I noticed with my experience so far:

  • I REALLY need to refresh my Object Oriented design skills, it’s been too long since I’ve used them
  • By doing just the minimum to make the tests ‘green’ I wrote far less code than I thought I would
  • My current code is far too coupled, I need to watch out for that because it’s hard to test
  • Once some tests are in place, refactoring is awesome, you know instantly if you broke something
  • TDD feels like another safety net above source control
  • Writing tests isn’t as hard as I thought
  • TDD is a completely different way of thinking about writing software

I’m pretty excited to continue on this path and fully explore what TDD can offer. I’m thinking some continuous integration and maybe, just maybe, some automated UI testing down the road. It’s a brave new world!

What’s your experience with TDD been like? Any tips PHP specific or not? Please just leave a comment below.


i spend more than one month trying to consume php web service by c#.net client without any success.:(

my problem is:
i have a webservice by using php+ nusoap
i call its methods from php client and send soapheader in the message like this:

$header =’


it works fine.
i also have a c$.net client, i add my webservice as a web reference and use proxy object to call web methods without soap header and it works fine,
but i don’t know how to add soapheader to the message.

my ideas are:
1- add a soapheader definition to the wsdl file, but i failed cause i
don’t know how to add soapheader manually to wsdl,
i write it bymyself like: to add a web method: $server->register(‘getdata’,


2- use httpWebRequest, but i read thad it is not a normal way, and i don’t know it’s disadvantages.
3- user WCF client: but i am new to .net, so i don’t know about wcf and if i can use it to consume my webservice (php+nusoap) with soapheader.

please any idea ????

Sorry, I don’t know the answer to your question, but I’d suggest you ask it over at Stackoverflow.com if you haven’t already.

Leave a Reply