About the Author

Chris Shiflett

Hi, I'm Chris, a web developer and a founding member of Analog. I live and work in Brooklyn, NY.


Apache-Test and SimpleTest

I've been answering questions lately on the SitePoint forums - PHP, Advanced PHP Programming, and Web Security.

One topic really caught my attention - How many actually use unit testing?. No, it wasn't the grammatical error that caught my eye but rather the fact that unit testing was being discussed on a PHP forum.

While reading the topic, I realized that there were many PHP developers using SimpleTest. Feeling like the black sheep, I mentioned my admiration for Apache-Test. I also tried to surmize why it isn't as popular in the PHP community as it is in the Perl community:

I'm not sure whether the average PHP developer would feel comfortable using it. Its userbase has traditionally been C, Perl, and mod_perl developers writing Apache modules and web applications that utilize many of the Apache API's hooks, etc. These people are comfortable on a command line and are writing some pretty complex code that needs the level of testing purity provided by Apache-Test.

When asked for an example test, I pointed readers to the Apache-Test demo that Geoff and I created last year.

Marcus Baker, author of SimpleTest, replied with the following:

Would you be willing to help with getting SimpeTest working with Apache-test?

I replied that I'd be happy to, and now Marcus and I are going to be working together to make SimpleTest output a TAP compliant protocol.

As Geoff is fond of saying, "Build it, and they will come." Well, hopfully Marcus and I can help make all of Geoff's work worthwhile, and hopefully the PHP community can catch up with the Perl community in terms of testing.

About This Post

Apache-Test and SimpleTest was posted on Mon, 21 Mar 2005 at 03:55:25 GMT.

6 Comments

1. Matthew Weier O'Phinney's GravatarMatthew Weier O'Phinney said:

I've been toying with unit tests for the past 6-9 months, particularly when writing APIs at work. I've tried both PHPUnit and SimpleTest, and currently use SimpleTest if I utilize unit tests at all -- primarily because it's so well documented. I've followed several of your blog entries about using Apache-Test, and am considering trying it out on my next foray into testing.

What I find most difficult about unit tests is getting myself into a position where I can actually do them. Unfortunately, formal process is generally... lacking... on many of the projects I work on, which means that requirements are often changing up to the day of launch. This makes it difficult to get into good testing habits, as I often don't know enough about how the applications I'm programming are supposed to behave to be able to write a test.

That said, when the stars have aligned properly and I *have* been able to build to test, unit tests have been incredibly helpful in getting my APIs working solidly. My biggest gripe has been my inability to test similarly for the actual application -- and this is where I can see Apache-Test filling a wonderful niche. I look forward to seeing how the integration with SimpleTest comes along -- and hope that it's documented as well as SimpleTest has always been.

Mon, 21 Mar 2005 at 04:51:19 GMT Link


2. perrick's Gravatarperrick said:

Looks like I'll have more documentation to translate into french ;-) I'm looking forward to it !

Mon, 21 Mar 2005 at 08:12:46 GMT Link


3. Geoffrey Young's GravatarGeoffrey Young said:

it seems like a good match. really, what Apache-Test provides is a framework to build upon - that we added test-more.php was really just a way to give php folks an easy way to use the infrastructure. Simple Test looks to provide lots that is valuable when writing tests, such as mock objects, so joining the two ought to be pretty powerful.

Mon, 21 Mar 2005 at 15:20:37 GMT Link


4. Jim Plush's GravatarJim Plush said:

I've justed started to get some free time to start implementing Unit Testing using PHPUnit. I'm finding it a really valuable tool in the enterprise world.

Mon, 21 Mar 2005 at 18:15:51 GMT Link


5. Chris Shiflett's GravatarChris Shiflett said:

Some people have asked whether this will require OOP. As far as I can tell, SimpleTest does, but the bundled test-more.php library that comes with Apache-Test can be used in either OOP or procedural applications.

Thu, 24 Mar 2005 at 06:29:51 GMT Link


6. Geoffrey Young's GravatarGeoffrey Young said:

wrt oop, that's part of the beauty of Apache-Test - it sets everything up and lets you choose the testing library. so, if you like oo use a Simple Test-type syntax. if you like procedural tests, use the included test-more.php. or use test-more.php for oo if you like (I do all the time over in perl land). or write your own TAP-compliant library.

none of this matters to Apache-Test, which is just in charge of configuring up apache, starting the server, running your tests, and aggregating the results, and stopping the server in preparation for another run.

Fri, 25 Mar 2005 at 01:03:33 GMT Link


Post A Comment

Personal Details and Comment

Style Guide

Line breaks are converted to paragraphs. Also use:

  • <a href="" title="">text</a>1
  • <em>text</em>
  • <blockquote><p>text</p></blockquote>
  • <code>2  <?php  if ($foo) {      $foo = TRUE;  }  ?></code>
  1. Note: <code> can be used inline (e.g. in paragraphs) or in a block as shown. Include whitespace and newlines in blocks.

Please enter Chris (my first name) below. This is a primitive spam prevention technique, and I apologize for the inconvenience.

Preview and Submit

Upcoming Events

Brooklyn Beta

21 - 22 Oct 2010

At The Invisible Dog, Brooklyn, New York.

New Comments

Mario Arroyo wrote:

The article is really very good and the users comments and external links to another articles jus...

Posted in
Raphael Almeida wrote:

I realy like hiphop music, but this is very crazy! We'll use it in user group PHP conference at ...

Posted in PHP Anthem
Mal wrote:

Having used smarty for many years, this has never been a problem for me, but after building a web...

Posted in PHP Stripping Newlines
Satya wrote:

Thanks for the info. I have posted the news here on my page: http://www.facebook.com/pages/Web-Sc...

Posted in PHP Anthem
John wrote:

Oh, you need to press "save your password".

Posted in Mozilla Account Manager

Browse Comments


Work and Books

Analog Essential PHP Security HTTP Developer's Handbook