Introduction to Avignon

Avignon is an acceptance test system that allows you to write executable tests in a language that you define.  It uses XML to define the syntax of the language but, if you choose to extend the language, leaves the semantics of the tests up to you.

Features

Running Tests

Avignon is implemented in Java and is configurable for many different forms of test execution.

Configuration

Java Version

Avignon requires JDK 1.4 or better.

Classpath

Avignon needs several things in its classpath before it can run tests.  These are described below.

Jars

Avignon Properties

The Avignon.properties file contains the information that the test runner needs to load tag handlers, determine which browser to use, locate scripts, etc.  Some of the main properties are described below, but please see the AvignonProperties JavaDoc for full details.

Java Properties

You may tell Avignon which properties file to use by specifying a Java system property on the command line..  These are specified as “–D” arguments to java, such as:

java ‑DAvignonProperties=c:\mytests\Avignon.properties

Other packages such as the IE integration or .NET integration will have their own system properties that need to be set.

JUnit Test Runners

Avignon has been used without issues with the following JUnit test runners:

Using Additional Tag Loaders

By default, Avignon uses a tag loader that searches for tag handlers based on the element name and the qualifiers specified in the HandlerPath property.  You may add additional tag loaders by putting the class names in the TagLoaders property and making sure that the actual classes are in the classpath.  The classes must implement the TagLoader interface.  This interface has one method called findTagHandler that should search for a handler based on the name specified in the parameter; return an AvignonTagHandler if you want to implement the tag or null if you do not..  The Java tag loader is always called first.  After that, tag loaders are tried in the order in which they appear in the TagLoaders property until a tag handler is found or the end of the list is reached.

The XML Tag Loader

A new additional tag loader included with Avignon is the XML Tag Loader. This tag loader makes it easier to include other test scripts inside of a Test Suite. For example, if a suite contains

<Login username="someone" password="something"/>
and a file named Login.xml is in the same directory as the test suite file, this file will be included in the test execution, and parameters named #username# and #password# in the file will be replaced with the appropriate values.

Writing Tests

Overview

Avignon tests are written in XML and executed by a JUnit test runner using small pieces of Java code associated to each XML tag.  It comes with a number of tags already coded that allow fairly effective testing of web applications and limited testing of Java Swing and AWT based applications, but you can derive the most benefit from it by using its extensibility to create your own testing language that best expresses your tests.

Delivered Tags

The JavaDoc contains descriptions of all delivered tags, including core tags and database manipulation. 

Extending Avignon

Avignon itself comes with a fairly minimal set of tags; adding your own custom tags gives you more power to express your tests.

Test Writer’s Perspective

From the test writer’s perspective, adding new tags is quite simple.  Just make up a name for it, decide what attribute you’ll need for it, and communicate it to the developers.  If you include a tag that doesn’t have any code written for it in your test, it will just appear as an error in the JUnit output.

Developer’s Perspective

From the developer’s perspective, creating new tag handlers is a little more difficult but not terribly so.  For each new tag, you’ll need to create a class with the same name plus the word Handler.  This class must implement the AvignonTagHandler interface and have a zero argument constructor.  The interface gives you two methods: start and end.  The start method is called each time the tag is opened in a test.  It gets the current AvignonTestState, which allows you to record errors and search for surrounding tags, and any XML attributes that were in the test.  The end method is called each time the tag closes in a test.  It gets the current AvignonTestState as a parameter.  You can make any assertions or do any actions necessary is either the start or end methods.