usable in any place a human can be used


open source

[caption id="attachment_602" align="alignleft" width="300" caption="insert stupid star wars pun here"]testing motivational poster[/caption]

I've been getting into the guts of the SimpleTest trying to make it bend to my will. So far I've been pleased with the framework, I've been able to set up a testing structure that works for me. To understand the testing structure better you need to know a little about prosper's structure.

Prosper uses a classic adapter pattern to handle the different backends it supports, so it has a directory structure similar to the following

  • Query.php

  • Adapters/

    • BaseAdapter.php

    • PreparedAdapter.php

    • MySqlAdapter.php

    • etc...

Since I wanted the unit tests structure to make some sense I decided that there should be one point of entry that I could run to test every adapter and then entry points for each adapter individually. I ended up with a test structure like so.

  • All Tests (Suite)

    • MySQL Tests (Suite)

      • Select Statements

      • Insert Statements

      • etc...

    • Oracle Tests (Suite)

      • Select Statements

      • Insert Statements

      • etc...

    • etc...

[caption id="attachment_597" align="alignright" width="300" caption="All my tests pass but its just so boring"]standard simpletest theme[/caption]

This structure is working nicely and now I get to have the fun of writing hundreds and hundreds of unit tests, it really puts into perspective the shear size and scope that prosper has grown into. The next thing though was that I wanted beautiful results. If I was going to have to look at these things all day, I wanted them to caress my eyeballs and make them feel all warm and fuzzy.

SimpleTest (like all PHP code) is open source and even has a way to extend the reporters, although its easier said than done. I fired up my favorite php editor and got down to work rewriting the HtmlReporter class so that the results were more to my liking. It was not the easiest task, but there is some ok documentation about it and the names were all fairly sensible. I hacked away at it, changing a little bit here or there and then finally decided to just scrap what they had wrote and redo most of it. It took some time to get everything squared away but with some inspiration ...cough...blatent theft...cough... from QUnit, I was able to make the following.

[caption id="attachment_599" align="aligncenter" width="300" caption="such hotness! unit tests have never looked so good"]simpletest skinned[/caption]

This is why I love open source so much, I wasn't stuck wishing that this thing looked better, I didn't have to resort to some sort of greasemonkey magic, I was able to fundamentally alter simpletest by changing the code. This is also why prosper is released under the MIT License, although recently I've been thinking about moving it to the Unlicense. I want people to be able to fix bugs, play around and change things, and ultimately make prosper a better tool.

Right now there are some Prosper specific hacks going on in the new reporter I wrote and its only been tested in Firefox, since its what I develop in when I'm on windows. I plan on cleaning up the code a bit and then submitting a patch to SimpleTest containing my new QHtmlReporter. This is part of being a good open source citizen, you can reap the benefits but then you should also try to pay it forward or back.

Open source software is empowering, not only in what it can do, but how it empowers the users to make them better. I'm going to continue writing up unit tests and with this awesome new display, my eyes will be happy to watch the results scroll by.


  1. Great work Matt. Your test testing has made me most curious of how it affects your work flow, since you come from a non-testing background (like myself).

  2. Prosper looks *sweet*. It'd be awesome if Prosper indeed were in the public domain. I think such a move would make for a decisive selling point over the numerous competing PHP libraries, setting Prosper clearly apart from the herd and allowing it to be easily embedded into any new emerging PHP web frameworks.

    It's worth mentioning that a key reason that SQLite, which is in the public domain, has prospered (no pun intended) has been the fact that it can be so easily (both technically and legally speaking) embedded into any other software. The end results of technical excellence combined with singularly liberal licensing speak for themselves:

    I think a lot of these same benefits could come into play also in such a potentially key higher-level web app infrastructure piece as Prosper. It certainly seems that you have the technical side of things well in hand, already, so here's hoping for a bright and prosperous future.

  3. Thanks for the kind words. To clear up any uncertainties, Prosper is released under the amazing Unlicense. The GitHub repo has been updated to include the proper documentation, I will be writing a blog post about this choice for tomorrow.