org.apache.ant.antunit.listener
public abstract class BaseAntUnitListener extends java.lang.Object implements AntUnitListener
| Modifier and Type | Class and Description |
|---|---|
static class |
BaseAntUnitListener.AntUnitLogLevel |
class |
BaseAntUnitListener.LogGrabber |
static class |
BaseAntUnitListener.SendLogTo |
| Modifier and Type | Field and Description |
|---|---|
protected int |
errorCount
keeps track of the numer of executed targets, the failures an errors.
|
protected int |
failureCount
keeps track of the numer of executed targets, the failures an errors.
|
protected static java.text.NumberFormat |
nf
Formatter for timings.
|
protected int |
runCount
keeps track of the numer of executed targets, the failures an errors.
|
protected long |
start
time for the starts of the current test-suite and test-target.
|
protected long |
testStart
time for the starts of the current test-suite and test-target.
|
| Modifier | Constructor and Description |
|---|---|
protected |
BaseAntUnitListener(BaseAntUnitListener.SendLogTo defaultReportTarget,
java.lang.String extension) |
| Modifier and Type | Method and Description |
|---|---|
void |
addError(java.lang.String target,
java.lang.Throwable ae)
Invoked if any error other than a failed assertion occured
during execution.
|
void |
addFailure(java.lang.String target,
AssertionFailedException ae)
Invoked if an assert tasked caused an error during execution.
|
protected void |
close(java.io.OutputStream out) |
protected org.apache.tools.ant.Project |
getCurrentTestProject() |
protected org.apache.tools.ant.Location |
getLocation(java.lang.Throwable t) |
protected java.io.OutputStream |
getOut(java.lang.String buildFile) |
protected java.io.File |
getToDir()
Directory to write reports to.
|
protected void |
messageLogged(org.apache.tools.ant.BuildEvent event)
Gets messages from the project running the test target if their
level is at least of the level specified with
setLogLevel. |
protected java.lang.String |
normalize(java.lang.String buildFile)
Turns the build file name into something that vaguely looks
like a Java classname.
|
void |
setCurrentTestProject(org.apache.tools.ant.Project p)
Set a reference to the Project instance currently executing the
test target.
|
void |
setLogLevel(BaseAntUnitListener.AntUnitLogLevel l)
Sets the minimum level a log message must be logged at to be
included in the output.
|
void |
setParentTask(org.apache.tools.ant.Task t)
Set a reference to the AntUnit task executing the tests, this
provides access to the containing project, target or Ant's
logging system.
|
protected void |
setSendLogTo(BaseAntUnitListener.SendLogTo logTo)
Where to send the test report.
|
void |
setToDir(java.io.File f)
Sets the directory to write test reports to.
|
void |
startTest(java.lang.String target)
Invoked before a test target gets executed.
|
void |
startTestSuite(org.apache.tools.ant.Project testProject,
java.lang.String buildFile)
Invoked once per build file, before any targets get executed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitendTest, endTestSuiteprotected static final java.text.NumberFormat nf
protected int runCount
protected int failureCount
protected int errorCount
protected long start
protected long testStart
protected BaseAntUnitListener(BaseAntUnitListener.SendLogTo defaultReportTarget, java.lang.String extension)
protected final java.io.File getToDir()
public void setToDir(java.io.File f)
protected void setSendLogTo(BaseAntUnitListener.SendLogTo logTo)
public void setParentTask(org.apache.tools.ant.Task t)
AntUnitListenersetParentTask in interface AntUnitListenerpublic void startTestSuite(org.apache.tools.ant.Project testProject,
java.lang.String buildFile)
AntUnitListenerstartTestSuite in interface AntUnitListenerprotected final void close(java.io.OutputStream out)
public void startTest(java.lang.String target)
AntUnitListenerstartTest in interface AntUnitListenerpublic void addFailure(java.lang.String target,
AssertionFailedException ae)
AntUnitListeneraddFailure in interface AntUnitListenerpublic void addError(java.lang.String target,
java.lang.Throwable ae)
AntUnitListeneraddError in interface AntUnitListenerprotected final java.io.OutputStream getOut(java.lang.String buildFile)
protected final java.lang.String normalize(java.lang.String buildFile)
protected final org.apache.tools.ant.Location getLocation(java.lang.Throwable t)
public void setCurrentTestProject(org.apache.tools.ant.Project p)
AntUnitListenerThis provides access to the logging system or the properties of the project under test. Note that different test targets will be executed in different Ant Project instances.
setCurrentTestProject in interface AntUnitListenerprotected org.apache.tools.ant.Project getCurrentTestProject()
public void setLogLevel(BaseAntUnitListener.AntUnitLogLevel l)
protected void messageLogged(org.apache.tools.ant.BuildEvent event)
setLogLevel.
This implementation is empty.