phpUnderControl – Continuous Integration

Well, over the last 3 days or so, I’ve been doing some serious unit testing with PHPUnit.  Unfortunately, I didn’t start writing any serious tests until two days AFTER I started having problems testing my class hierarchy.

One of the problems that arose while I was writing the first couple of unit tests, was I realized that I didn’t know how to test Abstract classes.  In my search to find a solution, I vaguely remembered a tool called phpUnderControl.

phpUnderControl is a Continuous Integration tool.  For anyone from a Java background, think CruiseControl and you know what I’m talking about.  phpUnderControl is in fact a plugin for CruiseControl.  The idea behind Continuous Integration is simply this: automate the build; make the build self-testing; use some kind of Source Control system to maintain the code.

The reason for this become clear when you work in a distributed, collaborative environment.  If everyone commits to the repository regularly, but no tests are run on each commit, there is no way to know if that latest commit has “integrated” in to the system correctly.  By building the system every time there is a commit AND running the test suite over the newly committed code, you ensure that you’re code works and integrates into the rest of the system BEFORE it gets picked up by anyone else and ruins their local install.

The fact that your unit tests are run for you, the documentation gets built for you and you get to see a bunch of metrics on your code quality, test results, etc., makes phpUnderControl a really useful package and I would recommend anybody take the time to try it out and see how it works for you.

Comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: