WebAccept
The web testing tool

Samples

Here are some example tests so you can see how easy WebAccept is to use.

Simple example

Lets say I want to thest that my site is ranked in Google

<testfixture name="Google" host="http://www.google.com"> <test name="Search for WebAccept"> <get url="/search?=WebAccept" /> <assert hastext="WebAccept" message="Should contain WebAccept" /> <assert hasnottext="No results" message="Should return some results" /> </test> </testfixture>

Running tests from the command line

All tests defined in the XML files are launched from a simple command line

To launch all tests contained in a file:

c:\>webaccept -f:mytest.xml

To launch all tests contained in a directory:

c:\>webaccept -d:mytests

To output the results in a XML file:

c:\>webaccept -f:mytest.xml -o:out.xml

Post example

Get and Post method are supported. Here we post some information like any HTML form

<testfixture name="Test an HTML form" host="http://example.org"> <test name="Post something"> <post url="/myform.asp"> <param name="SomeField" value="TheValue" /> <param name="SomeOtherField" value="TheValue" /> </post> <assert hastext="Success" message="Should contain Success" /> </test> </testfixture>

Using Regex

Regular expressions can also be used in assertion to test if a returned page contains some specific partern.

<testfixture name="Test an HTML form" host="http://example.org"> <test name="Post something"> <post url="/myform.asp"> <param name="SomeField" value="TheValue" /> <param name="SomeOtherField" value="TheValue" /> </post> <assert matchregex="^([a-zA-Z0-9_\-\.]+)" message="Should not contain numbers" /> </test> </testfixture>

Using parameters

You can pass values that can be used in your test, here's how:

<testfixture name="Test an HTML form" host="${host}"> <test name="Post something"> <post url="/myform.asp"> <param name="${fieldname}" value="${value}" /> </post> <assert hastext="${text}" /> </test> </testfixture>/p>

Then run the test file with this line:

c:\>webaccept -f:mytest.xml -host:http://example.org -fieldname:SomeField -value:TheValue -text:SomeText