Class FormatterElement
A wrapper for the implementations of JUnitResultFormatter. In particular, used as a nested
<formatter> element in a <junit> task.
For example, adds a
<junit printsummary="no" haltonfailure="yes" fork="false">
<formatter type="plain" usefile="false" />
<test name="org.apache.ecs.InternationalCharTest" />
</junit>plain type implementation (
PlainJUnitResultFormatter) to display the results of the test.
Either the type or the classname attribute must be set.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEnumerated attribute with the values "plain", "xml" and "brief". -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet name of class to be used as the formatter.Get the extension used for the report file.voidsetClassname(String classname) Set name of class to be used as the formatter.voidsetExtension(String ext) Set the extension to use for the report file.voidSet whether this formatter should be used.voidsetOutput(OutputStream out) Set output stream for formatter to use.voidQuick way to use a standard formatter.voidSet whether this formatter should NOT be used.voidsetUseFile(boolean useFile) Set whether the formatter should log to file.booleanshouldUse(org.apache.tools.ant.Task t) Ensures that the selector passes the conditions placed on it withifandunlessproperties.
-
Field Details
-
XML_FORMATTER_CLASS_NAME
xml formatter class- See Also:
-
BRIEF_FORMATTER_CLASS_NAME
brief formatter class- See Also:
-
PLAIN_FORMATTER_CLASS_NAME
plain formatter class- See Also:
-
-
Constructor Details
-
FormatterElement
public FormatterElement()
-
-
Method Details
-
setType
Quick way to use a standard formatter.
At the moment, there are three supported standard formatters.
- The
xmltype uses aXMLJUnitResultFormatter. - The
brieftype uses aBriefJUnitResultFormatter. - The
plaintype (the default) uses aPlainJUnitResultFormatter.
Sets
classnameattribute - so you can't use that attribute if you use this one.- Parameters:
type- the enumerated value to use.
- The
-
setClassname
Set name of class to be used as the formatter.
This class must implement
JUnitResultFormatter- Parameters:
classname- the name of the formatter class.
-
getClassname
Get name of class to be used as the formatter.- Returns:
- the name of the class.
-
setExtension
Set the extension to use for the report file.- Parameters:
ext- the extension to use.
-
getExtension
Get the extension used for the report file.- Returns:
- the extension.
-
setOutput
Set output stream for formatter to use.
Defaults to standard out.
- Parameters:
out- the output stream to use.
-
setUseFile
public void setUseFile(boolean useFile) Set whether the formatter should log to file.- Parameters:
useFile- if true use a file, if false send to standard out.
-
setIf
Set whether this formatter should be used. It will be used if the property has been set, otherwise it won't.- Parameters:
ifProperty- name of property
-
setUnless
Set whether this formatter should NOT be used. It will not be used if the property has been set, orthwise it will be used.- Parameters:
unlessProperty- name of property
-
shouldUse
public boolean shouldUse(org.apache.tools.ant.Task t) Ensures that the selector passes the conditions placed on it withifandunlessproperties.- Parameters:
t- the task the this formatter is used in.- Returns:
- true if the formatter should be used.
-