Hi.

I am trying to put together a testing tool that includes some features of the Java tools HTTPUnit and JWebUnit. I would like people's views on which features they would like to see and also the sort of interface they would expect.

Features planned so far are...

  1. Header checks on reponses. Making sure certain headers are set, etc. and that a page is received at all.
  2. Link following, that is parsing the HTML response and being able to access the links by label. Useful for building site checks for valid links, forms and images.
  3. Form handling, including automatic submission of default values, cookie handling and post data possibly including mixed mime types.


JavaScript support is not on the feature list for a version one. Frames, XML-RPC and SOAP testing could be added, but only if there was a very strong demand.

There are two basic interface options: a browser view and a test case view. In the browser view you would do this...

PHP Code:
class MyPageTest extends UnitTestCase {
    function 
MyPageTest("My page") {
        
$this->UnitTestCase();
    }
    function 
testPageExists() {
        
$browser = &new TestBrowser($this);
        
$browser->expectConnection("http://mypage.com");
        
$browser->setExpectedResponseCodes(array(200));
        
$browser->fetch();
    }

In a test case view you do this...

PHP Code:
class MyPageTest extends WebTestCase {
    function 
MyPageTest("My page") {
        
$this->WebTestCase();
    }
    function 
testPageExists() {
        
$this->assertPageExists("http://mysite.com");
    }

This is obviously simpler, but a lot less flexible, especially when dealing with multiple requests (e.g. images in a page). I have to do a browser view anyway in order to implement the thing, but also so that other unit testers can use these components. How much of the other functionality would people like to see implemented in the test case view?

Feel free to post psuedo code examples of what you would like to be able to type. This is a wish list.

yours, Marcus.

p.s. http://sourceforge.net/projects/simpletest is the project, but only the CVS version has the HTTP functionality so far and the Alpha3 release doesn't quite match the tutorial :-(.

Alpha4 is coming soon (I am writing some documentation for it).