org.apache.tools.ant.taskdefs.optional.junit
Class FormatterElement
java.lang.Object
org.apache.tools.ant.taskdefs.optional.junit.FormatterElement
public class FormatterElement
extends java.lang.Object
A wrapper for the implementations of
JUnitResultFormatter
.
In particular, used as a nested
<formatter>
element in
a
<junit>
task.
For example,
<junit printsummary="no" haltonfailure="yes" fork="false">
<formatter type="plain" usefile="false" />
<test name="org.apache.ecs.InternationalCharTest" />
</junit>
adds a
plain
type implementation
(
PlainJUnitResultFormatter
) to display the results of the test.
Either the
type
or the
classname
attribute
must be set.
String | getClassname() - Get name of class to be used as the formatter.
|
String | getExtension() - Get the extension used for the report file.
|
void | setClassname(String classname) - Set name of class to be used as the formatter.
|
void | setExtension(String ext) - Set the extension to use for the report file.
|
void | setIf(String ifProperty) - Set whether this formatter should be used.
|
void | setOutput(OutputStream out) - Set output stream for formatter to use.
|
void | setType(FormatterElement.TypeAttribute type) - Quick way to use a standard formatter.
|
void | setUnless(String unlessProperty) - Set whether this formatter should NOT be used.
|
void | setUseFile(boolean useFile) - Set whether the formatter should log to file.
|
boolean | shouldUse(Task t) - Ensures that the selector passes the conditions placed
on it with
if and unless properties.
|
BRIEF_FORMATTER_CLASS_NAME
public static final String BRIEF_FORMATTER_CLASS_NAME
brief formatter class
PLAIN_FORMATTER_CLASS_NAME
public static final String PLAIN_FORMATTER_CLASS_NAME
plain formatter class
XML_FORMATTER_CLASS_NAME
public static final String XML_FORMATTER_CLASS_NAME
xml formatter class
getClassname
public String getClassname()
Get name of class to be used as the formatter.
getExtension
public String getExtension()
Get the extension used for the report file.
setClassname
public void setClassname(String classname)
Set name of class to be used as the formatter.
This class must implement
JUnitResultFormatter
classname
- the name of the formatter class.
setExtension
public void setExtension(String ext)
Set the extension to use for the report file.
ext
- the extension to use.
setIf
public void setIf(String ifProperty)
Set whether this formatter should be used. It will be
used if the property has been set, otherwise it won't.
ifProperty
- name of property
setOutput
public void setOutput(OutputStream out)
Set output stream for formatter to use.
Defaults to standard out.
out
- the output stream to use.
setType
public void setType(FormatterElement.TypeAttribute type)
Quick way to use a standard formatter.
At the moment, there are three supported standard formatters.
- The
xml
type uses a XMLJUnitResultFormatter
.
- The
brief
type uses a BriefJUnitResultFormatter
.
- The
plain
type (the default) uses a PlainJUnitResultFormatter
.
Sets
classname
attribute - so you can't use that
attribute if you use this one.
type
- the enumerated value to use.
setUnless
public void setUnless(String unlessProperty)
Set whether this formatter should NOT be used. It
will not be used if the property has been set, orthwise it
will be used.
unlessProperty
- name of property
setUseFile
public void setUseFile(boolean useFile)
Set whether the formatter should log to file.
useFile
- if true use a file, if false send
to standard out.
shouldUse
public boolean shouldUse(Task t)
Ensures that the selector passes the conditions placed
on it with if
and unless
properties.
t
- the task the this formatter is used in.
- true if the formatter should be used.