Eccles
Documentation
Home
User Guide
Javadoc
Validation Suite
Test results XML
Test results HTML
Tag Documentation
Basic
Web Testing
Project
Sourceforge Project
SourceForge Logo
Basic Tags

These are the basic tags, almost like a language

Tag NameDescription
_defaultDefinition of the set of properties that all tags expose
assertLog an error or success report depending on a test
catchCatch an exception
collate-resultsCollate a subsection of results.
elseRun children if test is not true
for-eachRun children over all items of a collection
ifRun children if test is true
logWrite a message to the log
loopExecute the child tags a number of times
propertyDefine or set a property
reportReport a message to the output file
run-testRun a named set of tests
testDefine a test
throwThrow an exception
tryA block of code that can have exceptions trapped
_default - Definition of the set of properties that all tags expose
Every tag in the system implements these properties, although they may not be used or indeed useful in every situation
Attribute NameDescription
idAn identifier used to find a tag, either for calling sub tags or breaking control back to a previous tag
nameA name object that is used simply for naming a section of tags.
assert - Log an error or success report depending on a test [no children]

A simple error/success reporting tag.

test is evaluated to a boolean. If the value is false, a report is generated with message and type. If the value is true, then a report is generated with count type.

Attribute NameDescription
continueIf set to true, execution of tags in the current context will continue even if the test==false. Otherwise throw an AssertionException. [default value: false]
countReport type name that is incremented when test==true
messageMessage that will be output when the test==false
testBoolean test expression [Required]
typeReport type to be used for message if test==false. [default value: error]
catch - Catch an exception

See the try tag for usage information

Attribute NameDescription
typeType of the class to be caught [Required]
collate-results - Collate a subsection of results.

Collate a subsection of results. At the tag end, will display the count of all results encountered in this subsection

Attribute NameDescription
else - Run children if test is not true

See the if tag

Attribute NameDescription
for-each - Run children over all items of a collection

Run the children x number of times where x is the number of items in the specified collection. Place the item from the collection & the index of the item into properties

Attribute NameDescription
collectionExpression which should evaluate to a Collection, Iterator or array. [Required]
indexName of property to which the index of the item is written. [default value: index]
propertyName of property to which the item from the collection is stored. [default value: item]
if - Run children if test is true

Example

<if test="${foo>1}">
    <log message="the test was true"/>
    ....
</if><else>
    <log message="the test was false"/>
    ....
</else>

Attribute NameDescription
testThe boolean test value [Required]
log - Write a message to the log [no children]

This is used to display debugging or progress messages, and is not output to the results

Attribute NameDescription
levelThe level of the message. Possible values: FATAL, ERROR, WARN, INFO, DEBUG. [default value: INFO]
messageThe message to be written out [Required]
loop - Execute the child tags a number of times

Not a proper replacement for a java 'for' loop, the values in here are static and the loop will execute at least one.

Example:

  <loop property="i" begin="0" end="10">
	   <log message="Inside loop, i=${i}"/>
  </loop>

Attribute NameDescription
propertyName of the property created holding the index value [Required]
beginFirst value in the rang [Required]
endLast value in the range. The range is inclusive [Required]
property - Define or set a property [no children]

This tag creates or reassigns properties. Properties are always created on the parent tag, thus being exposed for the rest of the siblings in this child list.

Note that either one of 'define' or 'set' must be used.

Attribute NameDescription
booleanValueThe value to be set or defined, whose type will be Boolean.
defineThe name of a new property to be created.
doubleValueThe value to be set or defined, whose type will be Double.
intValueThe value to be set or defined, whose type will be Integer.
longValueThe value to be set or defined, whose type will be Long.
setThe name of a pre-existing property to have it's value changed
valueThe value to be set or defined, whose type will be of the type returned by the expression evaluator.
report - Report a message to the output file [no children]

Report a message to the output file.

Attribute NameDescription
messageThe message
typeThe type of the report. [default value: info]
run-test - Run a named set of tests [no children]

The test named in the property 'id' is looked up in the global scope of test id's and executed

Attribute NameDescription
idThe id of the test to run [Required]
test - Define a test

Doesn't actually do anything other than execute it's children, but a handy name to use when defining callable tests, by using it's 'id' property.

Attribute NameDescription
idAn identifier used to find a tag, either for calling sub tags or breaking control back to a previous tag
throw - Throw an exception [no children]

Throw an exception, which can be caught by a try..catch block.

Attribute NameDescription
messageMessage to appear in the exception [Required]
typeType of the exception. If the type name does not contain a '.', then "java.lang." is prepended to the string. [Required]
try - A block of code that can have exceptions trapped

A try tag should be used in conjunction with one or more catch tags like this:

<try>
    ....
    .... Some tags which might throw an exception
    ....
    <catch type="NullPointerException">
        <log message="caught a NPE. Exception details: ${exception}" />
        <log message="Caught in NullPointerException block. it was ${exception}" />
        <log message="Underlying exception was ${_exception}" />
        <log message="Underlying exception class was ${_exception.class}" />
    </catch>
    <catch type="Exception">
        <log message="caught another exception"/>
    </catch>
</try>	

The exception type specified in the catch exception is a Java Exception type name. If not '.'s are found in that name then "java.lang." is automatically attached to the start of the string

The order of the catch statements is important, as in Java code. The first catch tag that matches the exception type is executed only, so place catches for your most derived types first.

In the scope of a catch block, two properties are defined, exception and _exception. These both refer to the caught exception. The exception property refers to the exception wrapper which contains the tag call stack (not the Java call stack). The _exception property refers to the underlying Java exception.

See also the throw tag.

Attribute NameDescription