Fork me on GitHub

The following Jelly tag libraries are defined in this project.

jelly:junit

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

This tag library is also available as an XML Schema

Tag Name Description
assert

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

assertEquals

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

assertFileContains

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

assertFileExists

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

assertFileNotFound

Checks that a file cant be found.

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 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 attribute can be specified ifthe caught exception is to be exported to a variable.

case

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

fail

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

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.

suite

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

assert

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

Attribute Name Type Description
test org.apache.commons.jelly.expression.Expression

Sets 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.

xpath org.jaxen.XPath

Sets 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.

assertEquals

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

Attribute Name Type Description
actual org.apache.commons.jelly.expression.Expression

Sets the actual value which will be compared against theexpected value.

expected org.apache.commons.jelly.expression.Expression

Sets the expected value to be tested against

assertFileContains

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

Attribute Name Type Description
file java.io.File

The file to be tested. If this file exists, the test will pass.

match java.lang.String

The content to be checked for. If this text matches some partof the given file, the test will pass.

assertFileExists

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

Attribute Name Type Description
file java.io.File

The file to be tested. If this file exists, the test will pass.

assertFileNotFound

Checks that a file cant be found.

Attribute Name Type Description
file java.io.File

The file to be tested. If this file exists, the test will pass.

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 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 attribute can be specified ifthe caught exception is to be exported to a variable.

Attribute Name Type Description
classLoader java.lang.ClassLoader

Sets the class loader to be used to load the exception type

expected java.lang.String

Sets 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

.

var java.lang.String

Sets the variable name to define for this expression.

case

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

Attribute Name Type Description
name java.lang.String

Sets the name of this test case

fail

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

Attribute Name Type Description
message java.lang.String

Sets the failure message. If this attribute is not specified then thebody of this tag will be used instead.

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 Name Type Description
listener junit.framework.TestListener

Sets the TestListener.to be used to format the output of running the unit test cases

result junit.framework.TestResult

Sets the JUnit TestResult used to capture the results of the tst

test junit.framework.Test

Sets the JUnit Test to run which could be an individual test or a TestSuite

suite

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

Attribute Name Type Description
name java.lang.String

Sets the name of this test suite

var java.lang.String

Sets the name of the test suite whichi is exported