Unit testing...

jonasbn on 2004-10-07T18:34:58

I finally took a serious look at simple-test, a unit testing framework for PHP. Its is an xUnit based framework, which mean it looks a lot like the things I did in VB.NET at my prior job.

The use of a unit-test framework gives me a lot of things, things I might have mentioned in this journal earlier and which might hear other of advocates of unit testing saying.

  • A possibility of asserting what I do is correct
  • Possibility of testing the code before delivering to my client
  • The freedom to refactor things
  • Elimination of fear in coding a language I am not that familiar with
NUnit eased my way into VB.NET and I hope simple-test will do the same for PHP. I will probably have to start looking around for a Unit-test framework for Javascript since these are the languages in which I do most of my work.

The last bullet is probably the most important, since I do not have the time to fool around too much, since time is money when you are a freelancer and eliminating fear really helps getting things moving.

Some guy at the YAPC::Europe in Belfast gave a lightning talk, where he quoted a more experienced co-worker who had said to him: "Never code in fear", inspired by this I am attempting to make this a rule of thumb in my business.

And I feel that things are improving...