Hi,

building websites can be tough, especially when there are CMS and Email-Forms on the page, because due to last minute changes in the sites, Emails can be lost and there might be malfunctions in the CMS, which of course only surface a week later, when the client actually starts to use the Site.

And no sweet talk, this happens to all of us, … well, until NOW.

We are going to do Test Driven Development. Enter SimpleTest.

It’s a really sweet and easy to use PHP based Unit testing framework.

I mostly use it like this:
I create a test case that logs into the CMS admin, adds an article via a from, then loads the actual site, checks if a text from the testing article is found on the page, and then it goes back to the admin interface and deletes said article.

This might sound quite simple, and with SimpleTest, it indeed is. And the little bit of extra effort saves a magnitude of headaches later on. It’s useful also for example when you are testing a website on your own testing webhost, and then upload it to the clients webspace, which runs quite likely a different version of PHP, differently configured (broken ;-) ). Having some tests available is convenient to make sure that stuff actually works, after you’ve fixed the most obvious screwups.

If we were living in a perfect world, we would only deploy to a “certified” webhost, ;-) But well, you know how things are.

SimpleTest is also convenient as you are really testing on the “actual” website, and not on any kind of internal code representation, therefore you can also use it to test arbitrary websites, which might not have been programmed in PHP even.

Oh, and the SimpleBrowser in SimpleTest is also quite convenient to programmatically control websites, login, post stuff, etc. like sending spam, erhm,… posting important updates of course.

And if you are going to test thoroughly, you also want to test your form-mails, for which you can setup SimpleMail with Fakemail. But for this you need a “real” webhost with shell access, where you can run either python or perl scripts, because Fakemail is available for those two languages.

Have fun,
Cheers
-Richard

Tags Development, Geek Documents

Leave a Reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image