UnitTesting PHP

Once you've discovered the advantages of unittests you'll never want to write one single line of code without a test for it (well allmost ;)). You'll become "test-infected" :).

A few months ago, while doing a project in .NET, I discovered these advantages. Having unittests for your code helps you to refactor your code and add new/modified features to your application without having to fear that you'll break your code. Ofcourse you can still break your code, but if you have good unittests you'll immediately notice that you broke something and, depending on how good your tests are, you will also know where you broke something. When you have UnitTests you'll feel a lot safer when touching your code.

Today allmost every language has one or more unittesting frameworks. Most of them are based on JUnit, and are called xUnit frameworks. One example is NUnit, which is the JUnit port to .NET. Also PHP has it's unittesting frameworks, of which PHPUnit and SimpleTest are the best known.

Continue reading on my mainblog...


There are no comments.

Comment Atom Feed