Package org.apache.ant.antunit.junit3
Class AntUnitSuite
- java.lang.Object
-
- junit.framework.TestSuite
-
- org.apache.ant.antunit.junit3.AntUnitSuite
-
- All Implemented Interfaces:
junit.framework.Test
public class AntUnitSuite extends junit.framework.TestSuiteA JUnit 3 TestSuite that group a suite of AntUnit targets coming from an ant script.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAntUnitSuite.MyProjectFactoryThe antscript project factory that creates projects in a junit context.
-
Field Summary
Fields Modifier and Type Field Description private AntUnitScriptRunnerantScriptRunnerprivate ErrorTestCaseinitializationReportingTestprivate MultiProjectDemuxOutputStreamstderrprivate MultiProjectDemuxOutputStreamstdout
-
Constructor Summary
Constructors Constructor Description AntUnitSuite(java.io.File scriptFile, java.lang.Class rootClass)Create a JUnit TestSuite that when executed will run the given ant script.AntUnitSuite(AntUnitTestCase singleTc, java.io.File scriptFile)Constructor used by AntUnitTestCase when a single test case is created.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.tools.ant.BuildExceptiongetAntInitialisationException()booleanhasAntInitError()voidrun(junit.framework.TestResult testResult)voidrunInContainer(java.util.List targetList, AntUnitExecutionNotifier notifier)Execute the test suite in a 'container' similar to the ant 'container'.voidrunTest(junit.framework.Test test, junit.framework.TestResult result)
-
-
-
Field Detail
-
antScriptRunner
private final AntUnitScriptRunner antScriptRunner
-
stderr
private final MultiProjectDemuxOutputStream stderr
-
stdout
private final MultiProjectDemuxOutputStream stdout
-
initializationReportingTest
private final ErrorTestCase initializationReportingTest
-
-
Constructor Detail
-
AntUnitSuite
public AntUnitSuite(java.io.File scriptFile, java.lang.Class rootClass)Create a JUnit TestSuite that when executed will run the given ant script.Note that it is the responsibility of the caller to give the correct File reference. Namely, if the File is a relative file, it will be resolve relatively to the execution directory (which might be different different from the project root directory).
- Parameters:
scriptFile- AntUnit script filerootClass- The test class that creates this suite. This is used to give a name to the suite so that an IDE can reexecute this suite.
-
AntUnitSuite
AntUnitSuite(AntUnitTestCase singleTc, java.io.File scriptFile) throws org.apache.tools.ant.BuildException
Constructor used by AntUnitTestCase when a single test case is created. The difference with the public constructor is this version doesn't set the name.- Throws:
org.apache.tools.ant.BuildException- when the file project can not be create (parsed/read)
-
-
Method Detail
-
run
public void run(junit.framework.TestResult testResult)
Run the full AntUnit suite.
- Specified by:
runin interfacejunit.framework.Test- Overrides:
runin classjunit.framework.TestSuite
-
runTest
public void runTest(junit.framework.Test test, junit.framework.TestResult result)Run a single test target of the AntUnit suite. suiteSetUp, setUp, tearDown and suiteTearDown are executed around it.
- Overrides:
runTestin classjunit.framework.TestSuite
-
runInContainer
public void runInContainer(java.util.List targetList, AntUnitExecutionNotifier notifier)Execute the test suite in a 'container' similar to the ant 'container'.When ant executes a project it redirect the input and the output. In this context we will only redirect output (unit test are not supposed to be interactive).
- Parameters:
targetList- The list of test target to executenotifier- The AntUnit notifier that will receive execution notifications
-
hasAntInitError
public boolean hasAntInitError()
-
getAntInitialisationException
public org.apache.tools.ant.BuildException getAntInitialisationException()
-
-