Anteater
 
   

Anteater

printer
print-friendly
PDF

Ant-based functional testing

by Ovidiu Predescu, Jeff Turner

Introduction

Welcome to Anteater!

Anteater is a testing framework designed around Ant, from the Apache Jakarta Project. It provides an easy way to write tests for checking the functionality of a Web application or of an XML Web service.

The type of tests you can write using Anteater are:

  • Send a HTTP/HTTPS request to a Web server. When the response comes back, test that it meets certain criteria. You can check for HTTP headers and response codes, and validate the response body with regexp, XPath, Relax NG, or contentEquals tests, plus some binary formats. New tests can be easily added.
  • Listen for incoming HTTP requests at an given URL on the local machine. When a request comes on that URL, you can check its parameters and/or content, and send a response accordingly.

The ability to wait for incoming HTTP messages is something unique to Anteater, which makes it especially useful when building tests for applications that use high level SOAP-based communication, like ebXML or BizTalk. Applications written using these protocols usually receive SOAP messages, and send back a meaningless response. It is only later when they inform the client, using an HTTP request on the client, about the results of the processing. These are the so-called asynchronous SOAP messages, and are the heart of many high-level protocols based on SOAP or XML messages.

Here is a simple example written using Anteater:

<target name="simple">
  <soapRequest description="Post a simple SOAP request"
               href="http://services.xmethods.net:80/soap"
               content="test/requests/get-quote">
    <namespace prefix="soap" uri="http://schemas.xmlsoap.org/soap/envelope/"/>
    <namespace prefix="n" uri="urn:xmethods-delayed-quotes"/>
    <match>
      <responseCode value="200"/>
      <xpath select="/soap:Envelope/soap:Body/n:getQuoteResponse/Result"/>
    </match>
  </soapRequest>
</target>

Anteater provides XML and text logging support, and the ability to render the logs into HTML reports.

Features

  • Uses Ant as a technical foundation, taking advantage of Ant's stability, features, widespread deployment and acceptance.
  • Built-in webserver allows testing of HTTP requests as well as responses, making Anteater uniquely suitable for testing interactive web services.
  • Suitable for non-interactive, cron-driven use in Continuous integration environments. Provides one-step deployment, testing and reporting of webapps.
  • Provides XML logging and HTML reporting, extending that found in Ant's JUnit tasks. Supports frames and non-frames HTML output. The generated HTML is easily customizable to match your website's look.
  • Tests in scripts can be grouped by functionality, or any other classification scheme. Grouped tasks can share common configurations, allowing the user to manage large scripts easily. Groups are hierarchical, with configurations being inherited. The grouping system is fully integrated with the HTML reporting, so test reports are meaningfully classified.
  • Anteater updates (new matchers, schemas, bugfixes, even version upgrades) can be automatically downloaded and installed as needed.
  • Comes with extensive documentation in the form of a 40-page user manual, available as HTML or PDF, plus numerous example scripts.

What's New

Version 0.9.16 release (2003-04-12).

A release containing 4 months of accumulated bug fixes and the occasional new feature. There are various followRedirects fixes, contentEquals now doesn't always pass, HTTP BASIC authentication works properly, and failing tests now generate a log file. New features include a fileRequest task for querying local files, and more flexible logging. See the changelog for details.

One important change: Anteater 0.9.16 requires JDK 1.4 to run. This is to support internationalization and HTTPS features.

Version 0.9.15 release (2002-11-16).

The primary functional improvement is the addition of code from Ivelin Ivanov, to allow SSL support of unsigned certificates.

Another significant reporting fix: JTidy errors are now reported properly instead of just on stdout, making HTML reports much more comprehensible. The 'description' attribute is now used in reports.

Version 0.9.14 release (2002-10-25).

Some nice new stuff, and lots of bugfixes and tweaks. Two frequently requested new features are HTTPS support (with proxy tunnelling) and the 'followRedirects' attribute, which makes Anteater automatically follow HTTP 302 client-side redirects.

The other major addition is the <uses> tag, which lets a script declare what optional features of Anteater, and Anteater version, it requires. Whenever a script requires a feature made available through the update system, a corresponding <uses> clause should be added. Then when a user without that update comes along, they'll get a nice message telling them how to upgrade, rather than an obscure error message.

I've been writing a pretty extensive Cocoon test suite of late, during which I made the numerous other small improvements and bugfixes. The Cocoon testsuite is a nice demonstration that Anteater does indeed scale.

Version 0.9.13 release (2002-10-11).

This version fixes a serious bug with the anteater.bat script, and adds an automatic upgrade facility to Anteater. No more waiting for 5mb downloads!

Version 0.9.12 release (2002-10-6).

This version adds some conveniences over 0.9.11. It fixes some small reporting bugs, and the 'sendResponse' tag can now have nested 'responseCode', 'contentEquals' and 'header' elements.

Version 0.9.11 release (2002-10-5).

This version contains a number of important bugfixes (esp. for Windows users), and Jelly support.

Version 0.9.10 release (2002-09-28).

This version contains an important fix to the HTML frames reporting, plus a number of minor bugfixes and improvements. See the changelog for details.

Version 0.9.9.1 bugfix release (2002-09-19).

This version fixes a handful of bugs found in the 0.9.9 release.

Version 0.9.9 released! (2002-08-22)

This version includes significant new functionality over 0.9.3. See the changelog for more details.

Forrest logo