| org.apache.tools.ant.BuildFileTest
All known Subclasses: org.apache.tools.ant.taskdefs.optional.vss.MSVSSTest, org.apache.tools.ant.filters.DynamicFilterTest, org.apache.tools.ant.taskdefs.optional.sos.SOSTest, org.apache.tools.ant.filters.StripJavaCommentsTest, org.apache.tools.ant.taskdefs.TarTest, org.apache.tools.ant.taskdefs.UpToDateTest, org.apache.tools.ant.taskdefs.NiceTest, org.apache.tools.ant.taskdefs.optional.junit.JUnitReportTest, org.apache.tools.ant.taskdefs.optional.depend.DependTest, org.apache.tools.ant.filters.LineContainsTest, org.apache.tools.ant.taskdefs.TypeAdapterTest, org.apache.tools.ant.taskdefs.BasenameTest, org.apache.tools.ant.taskdefs.InputTest, org.apache.tools.ant.taskdefs.MacroDefTest, org.apache.tools.ant.taskdefs.InitializeClassTest, org.apache.tools.ant.taskdefs.ManifestClassPathTest, org.apache.tools.ant.types.optional.ScriptConditionTest, org.apache.tools.ant.taskdefs.condition.IsSignedTest, org.apache.tools.ant.taskdefs.GetTest, org.apache.tools.ant.types.optional.ScriptSelectorTest, org.apache.tools.ant.taskdefs.AntLikeTasksAtTopLevelTest, org.apache.tools.ant.types.FlexIntegerTest, org.apache.tools.ant.taskdefs.TaskdefsTest, org.apache.tools.ant.taskdefs.optional.XmlValidateCatalogTest, org.apache.tools.ant.taskdefs.email.EmailTaskTest, org.apache.tools.ant.filters.TokenFilterTest, org.apache.tools.ant.taskdefs.AptTest, org.apache.tools.ant.taskdefs.TypedefTest, org.apache.tools.ant.taskdefs.condition.IsFailureTest, org.apache.tools.ant.taskdefs.optional.junit.JUnitTestListenerTest, org.apache.tools.ant.taskdefs.FilterTest, org.apache.tools.ant.taskdefs.RenameTest, org.apache.tools.ant.taskdefs.AntTest, org.apache.tools.ant.taskdefs.optional.ReplaceRegExpTest, org.apache.tools.ant.taskdefs.optional.PropertyFileTest, org.apache.tools.ant.taskdefs.CopydirTest, org.apache.tools.ant.taskdefs.BUnzip2Test, org.apache.tools.ant.taskdefs.AbstractCvsTaskTest, org.apache.tools.ant.taskdefs.RmicAdvancedTest, org.apache.tools.ant.types.optional.ScriptMapperTest, org.apache.tools.ant.types.DescriptionTest, org.apache.tools.ant.types.XMLCatalogBuildFileTest, org.apache.tools.ant.taskdefs.optional.i18n.TranslateTest, org.apache.tools.ant.taskdefs.condition.XorTest, org.apache.tools.ant.taskdefs.CopyTest, org.apache.tools.ant.taskdefs.ZipTest, org.apache.tools.ant.taskdefs.ExecTaskTest, org.apache.tools.ant.taskdefs.SleepTest, org.apache.tools.ant.taskdefs.SignJarTest, org.apache.tools.ant.taskdefs.LoadFileTest, org.apache.tools.ant.taskdefs.MultiMapTest, org.apache.tools.ant.DirectoryScannerTest, org.apache.tools.ant.taskdefs.XmlnsTest, org.apache.tools.ant.taskdefs.EchoTest, org.apache.tools.ant.taskdefs.ChecksumTest, org.apache.tools.ant.ImmutableTest, org.apache.tools.ant.taskdefs.DirnameTest, org.apache.tools.ant.TaskContainerTest, org.apache.tools.ant.taskdefs.optional.junit.XMLFormatterWithCDATAOnSystemOut, org.apache.tools.ant.taskdefs.optional.net.FTPTest, org.apache.tools.ant.taskdefs.condition.IsFileSelectedTest, org.apache.tools.ant.taskdefs.condition.AntVersionTest, org.apache.tools.ant.taskdefs.JavadocTest, org.apache.tools.ant.taskdefs.optional.RhinoReferenceTest, org.apache.tools.ant.taskdefs.TaskdefTest, org.apache.tools.ant.taskdefs.GUnzipTest, org.apache.tools.ant.LocationTest, org.apache.tools.ant.types.PropertySetTest, org.apache.tools.ant.taskdefs.LoadPropertiesTest, org.apache.tools.ant.taskdefs.optional.jdepend.JDependTest, org.apache.tools.ant.taskdefs.optional.BeanShellScriptTest, org.apache.tools.ant.taskdefs.DefaultExcludesTest, org.apache.tools.ant.taskdefs.condition.ParserSupportsTest, org.apache.tools.ant.ExtendedTaskdefTest, org.apache.tools.ant.taskdefs.ParallelTest, org.apache.tools.ant.taskdefs.PathConvertTest, org.apache.tools.ant.TopLevelTaskTest, org.apache.tools.ant.taskdefs.CopyfileTest, org.apache.tools.ant.taskdefs.optional.EchoPropertiesTest, org.apache.tools.ant.taskdefs.optional.image.ImageTest, org.apache.tools.ant.IncludeTest, org.apache.tools.ant.taskdefs.MkdirTest, org.apache.tools.ant.taskdefs.StyleTest, org.apache.tools.ant.types.ResourceComparatorsTest, org.apache.tools.ant.taskdefs.CVSPassTest, org.apache.tools.ant.filters.NoNewLineTest, org.apache.tools.ant.taskdefs.UntarTest, org.apache.tools.ant.taskdefs.JarTest, org.apache.tools.ant.taskdefs.optional.JavahTest, org.apache.tools.ant.taskdefs.EchoXMLTest, org.apache.tools.ant.taskdefs.JavaTest, org.apache.tools.ant.types.AddTypeTest, org.apache.tools.ant.taskdefs.SyncTest, org.apache.tools.ant.types.ResourceOutputTest, org.apache.tools.ant.taskdefs.DeltreeTest, org.apache.tools.ant.taskdefs.DeleteTest, org.apache.tools.ant.LoaderRefTest, org.apache.tools.ant.types.selectors.SignedSelectorTest, org.apache.tools.ant.taskdefs.ManifestTest, org.apache.tools.ant.taskdefs.GzipTest, org.apache.tools.ant.taskdefs.ConcatTest, org.apache.tools.ant.types.AssertionsTest, org.apache.tools.ant.taskdefs.AntStructureTest, org.apache.tools.ant.taskdefs.CallTargetTest, org.apache.tools.ant.DispatchTaskTest, org.apache.tools.ant.taskdefs.condition.TypeFoundTest, org.apache.tools.ant.types.FileListTest, org.apache.tools.ant.taskdefs.optional.JspcTest, org.apache.tools.ant.taskdefs.optional.XmlValidateTest, org.apache.tools.ant.taskdefs.optional.junit.JUnitTaskTest, org.apache.tools.ant.taskdefs.ImportTest, org.apache.tools.ant.types.optional.depend.ClassFileSetTest, org.apache.tools.ant.taskdefs.RecorderTest, org.apache.tools.ant.taskdefs.optional.Native2AsciiTest, org.apache.tools.ant.taskdefs.optional.DotnetTest, org.apache.tools.ant.taskdefs.optional.ANTLRTest, org.apache.tools.ant.taskdefs.FixCrLfTest, org.apache.tools.ant.taskdefs.condition.IsReachableTest, org.apache.tools.ant.types.mappers.GlobMapperTest, org.apache.tools.ant.types.PolyTest, org.apache.tools.ant.taskdefs.PropertyTest, org.apache.tools.ant.filters.ConcatFilterTest, org.apache.tools.ant.types.mappers.RegexpPatternMapperTest, org.apache.tools.ant.taskdefs.optional.script.ScriptDefTest, org.apache.tools.ant.taskdefs.optional.RhinoScriptTest, org.apache.tools.ant.types.resources.JavaResourceTest, org.apache.tools.ant.taskdefs.optional.SchemaValidateTest, org.apache.tools.ant.taskdefs.optional.XsltTest, org.apache.tools.ant.taskdefs.MakeUrlTest, org.apache.tools.ant.UnknownElementTest, org.apache.tools.ant.filters.EscapeUnicodeTest, org.apache.tools.ant.util.XMLFragmentTest, org.apache.tools.ant.taskdefs.DynamicTest, org.apache.tools.ant.taskdefs.WhichResourceTest, org.apache.tools.ant.taskdefs.BZip2Test, org.apache.tools.ant.taskdefs.LengthTest, org.apache.tools.ant.taskdefs.AvailableTest, org.apache.tools.ant.ExecutorTest, org.apache.tools.ant.taskdefs.PreSetDefTest, org.apache.tools.ant.taskdefs.AntlibTest, org.apache.tools.ant.PropertyExpansionTest, org.apache.tools.ant.AntClassLoaderTest, org.apache.tools.ant.taskdefs.optional.unix.SymlinkTest, org.apache.tools.ant.types.FilterSetTest, org.apache.tools.ant.CaseTest, org.apache.tools.ant.taskdefs.optional.WsdlToDotnetTest, org.apache.tools.ant.taskdefs.XmlPropertyTest, org.apache.tools.ant.taskdefs.condition.IsReferenceTest, org.apache.tools.ant.filters.HeadTailTest, org.apache.tools.ant.types.resources.TarResourceTest, org.apache.tools.ant.taskdefs.MoveTest, org.apache.tools.ant.taskdefs.SubAntTest, org.apache.tools.ant.taskdefs.TouchTest, org.apache.tools.ant.taskdefs.optional.PvcsTest, org.apache.tools.ant.types.RedirectorElementTest, org.apache.tools.ant.taskdefs.UnzipTest, org.apache.tools.ant.taskdefs.ConditionTest, org.apache.tools.ant.taskdefs.ProtectedJarMethodsTest, org.apache.tools.ant.taskdefs.ReplaceTest, org.apache.tools.ant.taskdefs.WarTest, org.apache.tools.ant.filters.ReplaceTokensTest, org.apache.tools.ant.taskdefs.FailTest,
BuildFileTest | abstract public class BuildFileTest extends TestCase (Code) | | A BuildFileTest is a TestCase which executes targets from an Ant buildfile
for testing.
This class provides a number of utility methods for particular build file
tests which extend this class.
|
Constructor Summary | |
public | BuildFileTest() Default constructor for the BuildFileTest object. | public | BuildFileTest(String name) Constructor for the BuildFileTest object. |
Method Summary | |
public void | assertDebuglogContaining(String substring) Assert that the given substring is in the log messages. | public void | assertLogContaining(String substring) Assert that the given substring is in the log messages. | public void | assertOutputContaining(String substring) Assert that the given substring is in the output messages. | public void | assertPropertyEquals(String property, String value) assert that a property equals a value; comparison is case sensitive. | public void | assertPropertySet(String property) assert that a property equals "true". | public void | assertPropertyUnset(String property) assert that a property is null. | public void | configureProject(String filename) | public void | configureProject(String filename, int logLevel) | public void | executeTarget(String targetName) | public void | expectBuildException(String target, String cause) | public void | expectBuildExceptionContaining(String target, String cause, String contains) | public void | expectDebuglog(String target, String log) Assert that the given message has been logged with a priority
>= VERBOSE when running the given target. | public void | expectLog(String target, String log) Assert that only the given message has been logged with a
priority <= INFO when running the given target. | public void | expectLogContaining(String target, String log) Assert that the given message has been logged with a priority
<= INFO when running the given target. | public void | expectOutput(String target, String output) | public void | expectOutputAndError(String target, String output, String error) | public void | expectPropertySet(String target, String property, String value) | public void | expectPropertySet(String target, String property) call a target, verify named property is "true". | public void | expectPropertyUnset(String target, String property) Call a target, verify property is null. | public void | expectSpecificBuildException(String target, String cause, String msg) Runs a target, wait for a build exception. | public BuildException | getBuildException() | public String | getError() | public String | getFullLog() Gets the log the BuildFileTest object. | public String | getLog() Gets the log the BuildFileTest object. | public String | getOutput() | public Project | getProject() Get the project which has been configured for a test. | public File | getProjectDir() Gets the directory of the project. | public URL | getResource(String resource) Retrieve a resource from the caller classloader to avoid
assuming a vm working directory. | protected void | tearDown() Automatically calls the target called "tearDown"
from the build file tested if it exits.
This allows to use Ant tasks directly in the build file
to clean up after each test. |
BuildFileTest | public BuildFileTest()(Code) | | Default constructor for the BuildFileTest object.
|
BuildFileTest | public BuildFileTest(String name)(Code) | | Constructor for the BuildFileTest object.
Parameters: name - string to pass up to TestCase constructor |
assertDebuglogContaining | public void assertDebuglogContaining(String substring)(Code) | | Assert that the given substring is in the log messages.
|
assertLogContaining | public void assertLogContaining(String substring)(Code) | | Assert that the given substring is in the log messages.
|
assertOutputContaining | public void assertOutputContaining(String substring)(Code) | | Assert that the given substring is in the output messages.
since: Ant1.7 |
assertPropertyEquals | public void assertPropertyEquals(String property, String value)(Code) | | assert that a property equals a value; comparison is case sensitive.
Parameters: property - property name Parameters: value - expected value |
assertPropertySet | public void assertPropertySet(String property)(Code) | | assert that a property equals "true".
Parameters: property - property name |
assertPropertyUnset | public void assertPropertyUnset(String property)(Code) | | assert that a property is null.
Parameters: property - property name |
configureProject | public void configureProject(String filename) throws BuildException(Code) | | Sets up to run the named project
Parameters: filename - name of project file to run |
configureProject | public void configureProject(String filename, int logLevel) throws BuildException(Code) | | Sets up to run the named project
Parameters: filename - name of project file to run |
executeTarget | public void executeTarget(String targetName)(Code) | | Executes a target we have set up
Parameters: targetName - target to run |
expectBuildException | public void expectBuildException(String target, String cause)(Code) | | run a target, expect for any build exception
Parameters: target - target to run Parameters: cause - information string to reader of report |
expectBuildExceptionContaining | public void expectBuildExceptionContaining(String target, String cause, String contains)(Code) | | run a target, expect an exception string
containing the substring we look for (case sensitive match)
Parameters: target - target to run Parameters: cause - information string to reader of report Parameters: contains - substring of the build exception to look for |
expectDebuglog | public void expectDebuglog(String target, String log)(Code) | | Assert that the given message has been logged with a priority
>= VERBOSE when running the given target.
|
expectLog | public void expectLog(String target, String log)(Code) | | Assert that only the given message has been logged with a
priority <= INFO when running the given target.
|
expectLogContaining | public void expectLogContaining(String target, String log)(Code) | | Assert that the given message has been logged with a priority
<= INFO when running the given target.
|
expectOutput | public void expectOutput(String target, String output)(Code) | | execute the target, verify output matches expectations
Parameters: target - target to execute Parameters: output - output to look for |
expectOutputAndError | public void expectOutputAndError(String target, String output, String error)(Code) | | Executes the target, verify output matches expectations
and that we got the named error at the end
Parameters: target - target to execute Parameters: output - output to look for Parameters: error - Description of Parameter |
expectPropertySet | public void expectPropertySet(String target, String property, String value)(Code) | | call a target, verify property is as expected
Parameters: target - build file target Parameters: property - property name Parameters: value - expected value |
expectPropertySet | public void expectPropertySet(String target, String property)(Code) | | call a target, verify named property is "true".
Parameters: target - build file target Parameters: property - property name |
expectPropertyUnset | public void expectPropertyUnset(String target, String property)(Code) | | Call a target, verify property is null.
Parameters: target - build file target Parameters: property - property name |
expectSpecificBuildException | public void expectSpecificBuildException(String target, String cause, String msg)(Code) | | Runs a target, wait for a build exception.
Parameters: target - target to run Parameters: cause - information string to reader of report Parameters: msg - the message value of the build exception we are waitingfor set to null for any build exception to be valid |
getFullLog | public String getFullLog()(Code) | | Gets the log the BuildFileTest object.
Only valid if configureProject() has been called.
The log value |
getLog | public String getLog()(Code) | | Gets the log the BuildFileTest object.
Only valid if configureProject() has been called.
The log value |
getProject | public Project getProject()(Code) | | Get the project which has been configured for a test.
the Project instance for this test. |
getProjectDir | public File getProjectDir()(Code) | | Gets the directory of the project.
the base dir of the project |
getResource | public URL getResource(String resource)(Code) | | Retrieve a resource from the caller classloader to avoid
assuming a vm working directory. The resource path must be
relative to the package name or absolute from the root path.
Parameters: resource - the resource to retrieve its url. throws: junit.framework.AssertionFailedError - if the resource is not found. |
tearDown | protected void tearDown() throws Exception(Code) | | Automatically calls the target called "tearDown"
from the build file tested if it exits.
This allows to use Ant tasks directly in the build file
to clean up after each test. Note that no "setUp" target
is automatically called, since it's trivial to have a
test target depend on it.
|
|
|