Tag Documentation

[tag libraries] [tags]

The following document contains a summary of all theJellytag libraries.

Tag Libraries

[tag libraries] [tags]

LibraryDescription
jelly:junit

A collection of JUnit tags for performing unit tests written in Jelly script.

The <suite>tag allows a test suite to be created and then test cases can either be individually ran or the whole suite ran.

The <case>tag allows a single test case to be created as part of a suite.

The <run>tag can be used to run a given Test, TestCase or TestSuite

There is an example of these tags in action here

jelly:junit

A collection of JUnit tags for performing unit tests written in Jelly script.

The <suite>tag allows a test suite to be created and then test cases can either be individually ran or the whole suite ran.

The <case>tag allows a single test case to be created as part of a suite.

The <run>tag can be used to run a given Test, TestCase or TestSuite

There is an example of these tags in action here

Tag NameDescription
assertPerforms an assertion that a given boolean expression, or XPath expression istrue. If the expression returns false then this test fails.
assertEqualsCompares an actual object against an expected object and if they are differentthen the test will fail.
assertFileContainsChecks that a file exists, and if not, then the test will fail.
assertFileExistsChecks that a file exists, and if not, then the test will fail.
assertFileNotFoundChecks that a file cant be found.
assertThrowsRuns its body and asserts that an exception is thrown by it. If noexception is thrown the tag fails. By default all exceptions are caught.If however expected was specified the body must throwan exception of the given class, otherwise the assertion fails. Theexception thrown by the body can also be of any subtype of the specifiedexception class. The optional var attribute can be specified ifthe caught exception is to be exported to a variable.
caseRepresents a single test case in a test suite; this tag is analagous toJUnit's TestCase class.
failThis tag causes a failure message. The message can eitherbe specified in the tags body or via the message attribute.
runThis tag will run the given Test which could be an individual TestCase or a TestSuite.The TestResult can be specified to capture the output, otherwise the results are outputas XML so that they can be formatted in some custom manner.
suiteRepresents a collection of TestCases.. This tag is analagous toJUnit's TestSuite class.

Tags

[tag libraries] [tags]

junit:assert

Performs an assertion that a given boolean expression, or XPath expression istrue. If the expression returns false then this test fails.

Attribute NameTypeDescription
escapeTextboolean
testorg.apache.commons.jelly.expression.ExpressionSets the boolean expression to evaluate. If this expression returns truethen the test succeeds otherwise if it returns false then the text willfail with the content of the tag being the error message.
trimboolean
xpathorg.jaxen.XPathSets the boolean XPath expression to evaluate. If this expression returns truethen the test succeeds otherwise if it returns false then the text willfail with the content of the tag being the error message.

junit:assertEquals

Compares an actual object against an expected object and if they are differentthen the test will fail.

Attribute NameTypeDescription
actualorg.apache.commons.jelly.expression.ExpressionSets the actual value which will be compared against theexpected value.
escapeTextboolean
expectedorg.apache.commons.jelly.expression.ExpressionSets the expected value to be tested against
trimboolean

junit:assertFileContains

Checks that a file exists, and if not, then the test will fail.

Attribute NameTypeDescription
escapeTextboolean
filejava.io.FileThe file to be tested. If this file exists, the test will pass.
matchjava.lang.StringThe content to be checked for. If this text matches some partof the given file, the test will pass.
trimboolean

junit:assertFileExists

Checks that a file exists, and if not, then the test will fail.

Attribute NameTypeDescription
escapeTextboolean
filejava.io.FileThe file to be tested. If this file exists, the test will pass.
trimboolean

junit:assertFileNotFound

Checks that a file cant be found.

Attribute NameTypeDescription
escapeTextboolean
filejava.io.FileThe file to be tested. If this file exists, the test will pass.
trimboolean

junit:assertThrows

Runs its body and asserts that an exception is thrown by it. If noexception is thrown the tag fails. By default all exceptions are caught.If however expected was specified the body must throwan exception of the given class, otherwise the assertion fails. Theexception thrown by the body can also be of any subtype of the specifiedexception class. The optional var attribute can be specified ifthe caught exception is to be exported to a variable.

Attribute NameTypeDescription
classLoaderjava.lang.ClassLoaderSets the class loader to be used to load the exception type
escapeTextboolean
expectedjava.lang.StringSets the class name of exception expected to be thrown by the body. Theclass name must be fully qualified and can either be the expectedexception class itself or any supertype of it, but must be a subtype of java.lang.Throwable .
trimboolean
varjava.lang.StringSets the variable name to define for this expression.

junit:case

Represents a single test case in a test suite; this tag is analagous toJUnit's TestCase class.

Attribute NameTypeDescription
escapeTextboolean
namejava.lang.StringSets the name of this test case
trimboolean

junit:fail

This tag causes a failure message. The message can eitherbe specified in the tags body or via the message attribute.

Attribute NameTypeDescription
escapeTextboolean
messagejava.lang.StringSets the failure message. If this attribute is not specified then thebody of this tag will be used instead.
trimboolean

junit:run

This tag will run the given Test which could be an individual TestCase or a TestSuite.The TestResult can be specified to capture the output, otherwise the results are outputas XML so that they can be formatted in some custom manner.

Attribute NameTypeDescription
escapeTextboolean
listenerjunit.framework.TestListenerSets the TestListener.to be used to format the output of running the unit test cases
resultjunit.framework.TestResultSets the JUnit TestResult used to capture the results of the tst
testjunit.framework.TestSets the JUnit Test to run which could be an individual test or a TestSuite
trimboolean

junit:suite

Represents a collection of TestCases.. This tag is analagous toJUnit's TestSuite class.

Attribute NameTypeDescription
escapeTextboolean
namejava.lang.StringSets the name of this test suite
trimboolean
varjava.lang.StringSets the name of the test suite whichi is exported