Has anyone put any thought into a RegressionTesting library for HTTP applications? Or is this just another type of GuiTesting?
----
See also relevant stuff at ServletTesting and EjbUnitTest. -- RichardEmerson
----
It appears that Expect is the most suitable language for HTTP and client/server applications. -- WillSargent
----
See TclExpect, and the book "ExploringExpect?" on TheTclersWiki (http://mini.net/cgi-bin/wikit/105.html).
"Expect" is a TCL library that's good for driving text-based user interfaces from TCL scripts. It's used to script interaction with servers, and can be used for testing, and many other things.
See also "The DejaGnu Testing Framework" (using TCL/Expect) at ftp://ftp.cygnus.com/pub/dejagnu/dejagnu.html
----
I wonder if TCL/Expect is the best tool for the job; I'd prefer something that can interpret the HTML as a browser does. -- JeffGrigg
----
A test suite for Apache is one of the things HP is offering money for at http://www.sourcexchange.com/ ''-- which has been closed down.''
----
I do this all the time in Perl, using LWP. Generally, I subclass LWP::UserAgent? to get something like F''''''ooTester, and then write code like this:
use Test;
BEGIN { plan test => 14 }
my $t = new F''''''ooTester;
$t->get('/');
ok($t->is_success);
ok($t->content =~ /
Front Page/i);
$t->post('/login', user => 'fred', passwd => 'xsecretx');
ok($t->is_success);
ok($t->content =~ /Successful Login/i);
ok($t->content =~ /fred/i);
ok($t->content !~ /xsecretx/i); # don't leak passwords...
-- PeteBevin
----
At Amazon.com we use a tool that I wrote called Frank. It is a Web testing scripting language that uses a basic grammar to define test cases. It uses Perl regular expressions (although the latest version is written in Java) to define most of the assertions we use. Here is a simple example:
GET "/some/url.html";
validate urls;
validate images;
pass if regex m/Some Content/;
the validations generate more tasks like the one above and every task gets a bunch of "implicit tasks" that apply to everything by default. Some can be overridden (like status code checks, by default they check for 200 but can be made to check anything else if explicitly stated).
The latest version is built on top of a distributed task engine that allows us to test an extensive regression test in under 30 minutes. The previous version, which is written in Perl, is single-threaded and I'm trying to get in released as open source. We shall see...
-- RyanDavis
----
Check out PBP at http://pbp.berlios.de/ --titus.
----
I rely mostly on my HTML write stream class. It will catch misspelt tags, unbalanced tags, INPUT tags not inside FORMs, and suchlike as the code generates them. I believe it will avoid most of the problems a general parser would find, very cheaply, because it starts from a high level representation. Eg I have methods like #putSubmit:value: so the checker knows a lot about what is going on without having to parse it. And of course it is easier for me to use than typing all those fiddly angle brackets by hand.
I use some other tests, for example asserting that the generated text contains a and and ends with