|
[tag libraries]
[tags]
Library | Description |
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
|
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 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
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. |
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.
|
[tag libraries]
[tags]
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 |
escapeText | boolean |
|
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. |
trim | boolean |
|
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. |
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. |
escapeText | boolean |
|
expected | org.apache.commons.jelly.expression.Expression | Sets the expected value to be tested against |
trim | boolean |
|
Checks that a file exists, and if not, then the test will fail.
Attribute Name | Type | Description |
escapeText | boolean |
|
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. |
trim | boolean |
|
Checks that a file exists, and if not, then the test will fail.
Attribute Name | Type | Description |
escapeText | boolean |
|
file | java.io.File | The file to be tested. If this file exists, the test will pass.
|
trim | boolean |
|
Checks that a file cant be found.
Attribute Name | Type | Description |
escapeText | boolean |
|
file | java.io.File | The file to be tested. If this file exists, the test will pass.
|
trim | boolean |
|
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 Name | Type | Description |
classLoader | java.lang.ClassLoader | Sets the class loader to be used to load the exception type |
escapeText | boolean |
|
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
java.lang.Throwable
. |
trim | boolean |
|
var | java.lang.String | Sets the variable name to define for this expression. |
Represents a single test case in a test suite; this tag is analagous toJUnit's TestCase class.
Attribute Name | Type | Description |
escapeText | boolean |
|
name | java.lang.String | Sets the name of this test case |
trim | boolean |
|
This tag causes a failure message. The message can eitherbe specified in the tags body or via the message attribute.
Attribute Name | Type | Description |
escapeText | boolean |
|
message | java.lang.String | Sets the failure message. If this attribute is not specified then thebody of this tag will be used instead. |
trim | boolean |
|
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 |
escapeText | boolean |
|
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
|
trim | boolean |
|
Represents a collection of TestCases.. This tag is analagous toJUnit's TestSuite class.
Attribute Name | Type | Description |
escapeText | boolean |
|
name | java.lang.String | Sets the name of this test suite |
trim | boolean |
|
var | java.lang.String | Sets the name of the test suite whichi is exported |
|