Klasse BaseAntUnitListener

java.lang.Object
org.apache.ant.antunit.listener.BaseAntUnitListener
Alle implementierten Schnittstellen:
AntUnitListener
Bekannte direkte Unterklassen:
FailureAntUnitListener, PlainAntUnitListener, XMLAntUnitListener

public abstract class BaseAntUnitListener extends Object implements AntUnitListener
A test listener for <antunit> modeled aftern the Plain JUnit test listener that is part of Ant.
  • Felddetails

    • nf

      protected static final NumberFormat nf
      Formatter for timings.
    • runCount

      protected int runCount
      keeps track of the numer of executed targets, the failures an errors.
    • failureCount

      protected int failureCount
      keeps track of the numer of executed targets, the failures an errors.
    • errorCount

      protected int errorCount
      keeps track of the numer of executed targets, the failures an errors.
    • start

      protected long start
      time for the starts of the current test-suite and test-target.
    • testStart

      protected long testStart
      time for the starts of the current test-suite and test-target.
  • Konstruktordetails

  • Methodendetails

    • getToDir

      protected final File getToDir()
      Directory to write reports to.
      Gibt zurück:
      directory to write reports to
    • setToDir

      public void setToDir(File f)
      Sets the directory to write test reports to.
      Parameter:
      f - directory to write reports to
    • setSendLogTo

      protected void setSendLogTo(BaseAntUnitListener.SendLogTo logTo)
      Where to send the test report.
      Parameter:
      logTo - where to send the test report
    • setParentTask

      public void setParentTask(org.apache.tools.ant.Task t)
      Beschreibung aus Schnittstelle kopiert: AntUnitListener
      Set a reference to the AntUnit task executing the tests, this provides access to the containing project, target or Ant's logging system.
      Angegeben von:
      setParentTask in Schnittstelle AntUnitListener
      Parameter:
      t - the parent task
    • startTestSuite

      public void startTestSuite(org.apache.tools.ant.Project testProject, String buildFile)
      Beschreibung aus Schnittstelle kopiert: AntUnitListener
      Invoked once per build file, before any targets get executed.
      Angegeben von:
      startTestSuite in Schnittstelle AntUnitListener
      Parameter:
      testProject - the project
      buildFile - the build file
    • close

      protected final void close(OutputStream out)
    • startTest

      public void startTest(String target)
      Beschreibung aus Schnittstelle kopiert: AntUnitListener
      Invoked before a test target gets executed.
      Angegeben von:
      startTest in Schnittstelle AntUnitListener
      Parameter:
      target - name of the target
    • addFailure

      public void addFailure(String target, AssertionFailedException ae)
      Beschreibung aus Schnittstelle kopiert: AntUnitListener
      Invoked if an assert tasked caused an error during execution.
      Angegeben von:
      addFailure in Schnittstelle AntUnitListener
      Parameter:
      target - name of the target
      ae - the failure
    • addError

      public void addError(String target, Throwable ae)
      Beschreibung aus Schnittstelle kopiert: AntUnitListener
      Invoked if any error other than a failed assertion occured during execution.
      Angegeben von:
      addError in Schnittstelle AntUnitListener
      Parameter:
      target - name of the target
      ae - the error
    • getOut

      protected final OutputStream getOut(String buildFile)
    • normalize

      protected final String normalize(String buildFile)
      Turns the build file name into something that vaguely looks like a Java classname. Close enough to be suitable for junitreport.
      Parameter:
      buildFile - the test file name
      Gibt zurück:
      the normalized name
    • getLocation

      protected final org.apache.tools.ant.Location getLocation(Throwable t)
    • setCurrentTestProject

      public void setCurrentTestProject(org.apache.tools.ant.Project p)
      Beschreibung aus Schnittstelle kopiert: AntUnitListener
      Set a reference to the Project instance currently executing the test target.

      This 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.

      Angegeben von:
      setCurrentTestProject in Schnittstelle AntUnitListener
      Parameter:
      p - the test project
    • getCurrentTestProject

      protected org.apache.tools.ant.Project getCurrentTestProject()
    • setLogLevel

      public void setLogLevel(BaseAntUnitListener.AntUnitLogLevel l)
      Sets the minimum level a log message must be logged at to be included in the output.
      Parameter:
      l - minimum level
    • messageLogged

      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.

      This implementation is empty.

      Parameter:
      event - the logged message