org.apache.commons.jelly.tags.junit

## Class RunTag

- java.lang.Object
- - org.apache.commons.jelly.TagSupport
  - - org.apache.commons.jelly.tags.junit.RunTag

All Implemented Interfaces:
  Tag

    public class RunTag
    extends TagSupport

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 output as XML so that they can be formatted in some custom manner.

Version:
  $Revision: 155420 $
Author:
  James Strachan

### Field Summary

### Fields inherited from class org.apache.commons.jelly.TagSupport

`body, context, parent`

### Constructor Summary

Constructors
Constructor and Description
`RunTag()`

### Method Summary

Methods
`protected junit.framework.TestResult` `createResult(XMLOutput output)` Factory method to create a new TestResult to capture the output of the test cases
`protected junit.framework.TestListener` `createTestListener(XMLOutput output)` Factory method to create a new TestListener to capture the output of the test cases
`void` `doTag(XMLOutput output)` Evaluates this tag after all the tags properties have been initialized.
`junit.framework.TestListener` `getListener()` Returns the listener.
`junit.framework.TestResult` `getResult()` Returns the TestResult used to capture the output of the test.
`junit.framework.Test` `getTest()` Returns the Test to be ran.
`protected void` `handleSAXException(SAXException e)` Handles SAX Exceptions
`void` `setListener(junit.framework.TestListener listener)` Sets the TestListener.to be used to format the output of running the unit test cases
`void` `setResult(junit.framework.TestResult result)` Sets the JUnit TestResult used to capture the results of the tst
`void` `setTest(junit.framework.Test test)` Sets the JUnit Test to run which could be an individual test or a TestSuite
`protected String` `stackTraceToString(Throwable t)`

### Methods inherited from class org.apache.commons.jelly.TagSupport

`findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### RunTag

    public RunTag()

### Method Detail

#### doTag

    public void doTag(XMLOutput output)
               throws MissingAttributeException,
                      JellyTagException

Description copied from interface: `Tag`
Evaluates this tag after all the tags properties have been initialized.

Throws:
  `MissingAttributeException`
  `JellyTagException`

#### getResult

    public junit.framework.TestResult getResult()

Returns the TestResult used to capture the output of the test.

Returns:
  TestResult

#### getTest

    public junit.framework.Test getTest()

Returns the Test to be ran.

Returns:
  Test

#### setResult

    public void setResult(junit.framework.TestResult result)

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

Parameters:
  `result` - The TestResult to use

#### setTest

    public void setTest(junit.framework.Test test)

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

Parameters:
  `test` - The test to run

#### getListener

    public junit.framework.TestListener getListener()

Returns the listener.

Returns:
  TestListener

#### setListener

    public void setListener(junit.framework.TestListener listener)

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

Parameters:
  `listener` - The listener to set

#### createResult

    protected junit.framework.TestResult createResult(XMLOutput output)

Factory method to create a new TestResult to capture the output of the test cases

#### createTestListener

    protected junit.framework.TestListener createTestListener(XMLOutput output)

Factory method to create a new TestListener to capture the output of the test cases

#### stackTraceToString

    protected String stackTraceToString(Throwable t)

Returns:
  the stack trace as a String

#### handleSAXException

    protected void handleSAXException(SAXException e)

Handles SAX Exceptions