ise.antelope.tasks
public class TestCase extends org.apache.tools.ant.Task
setFile
method, calls a
'setUp' target in that build file (if it exists), then all targets whose
names start with 'test', and last calls a target named 'tearDown' (if it
exists). Both 'setUp' and 'tearDown' are optional targets in the build file.
Ant stores targets in a hashtable, so there is no guaranteed order in which the 'test*' classes will be called. If order is important, use the 'depends' attribue of a target to enforce order, and do not name dependent targets with a name starting with 'test'.
Test targets may also be imported with the import task. Imported files should not have a "suite" task in the implicit target as such a task would rerun all test targets in all files.
Constructor and Description |
---|
TestCase() |
Modifier and Type | Method and Description |
---|---|
void |
execute()
Run tests.
|
int |
getFailedCount() |
java.util.Enumeration |
getFailures() |
java.lang.String |
getName() |
int |
getPassedCount() |
int |
getRanCount() |
java.lang.String |
getSummary()
Gets the summary attribute of the TestCase object
|
int |
getTestCaseCount() |
int |
getWarningCount() |
void |
init()
task initilization
|
void |
setAssertsenabled(boolean b)
Should Asserts be enabled? Many (most?) tests will use the Assert task,
which requires a property to be set to actually enable the asserts.
|
void |
setEnabled(boolean b) |
void |
setFailonerror(boolean b)
Should the build fail if the test fails? By default, a failed test does
not cause the build to fail, so all tests may have the opportunity to
run.
|
void |
setFile(java.io.File f) |
void |
setName(java.lang.String n)
Set the name for this testcase.
|
void |
setShowoutput(boolean b) |
void |
setShowsummary(boolean b) |
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
public void init()
init
in class org.apache.tools.ant.Task
public int getTestCaseCount()
public int getRanCount()
public int getFailedCount()
public int getWarningCount()
public int getPassedCount()
public java.util.Enumeration getFailures()
public void setShowoutput(boolean b)
b
- if true, show the output of the tests as they run. Optional,
default is true, do show output.public void setShowsummary(boolean b)
b
- if true, show the summary output (number of tests, passed,
failed) after the completion of all tests. Optional, default is
true, do show summary.public void setFile(java.io.File f)
f
- the file containing the tests to execute. Required. The file
itself is a standard Ant build file, but will be treated differently
than if Ant itself ran it. If there is a target named "setUp", that
target will be executed first, then all targets with names starting
with "test" (not in any particular order), then if there is a target
named "tearDown", that target will be executed last. All other
targets are ignored.public void setAssertsenabled(boolean b)
b
- if false, do not enable asserts. Note that this sets an Ant
property, and due to property immutability, this attribute may have
no effect if it has been set already. Generally, asserts are enabled
or disabled for an entire build.public void setFailonerror(boolean b)
b
- set to true to cause the build to fail if the test failspublic java.lang.String getName()
setName
. If the
name has not be explicitly set, then the test name is the project
name if there is one, otherwise, the filename of the test file.public void setName(java.lang.String n)
n
- the name for the testcasepublic void setEnabled(boolean b)
b
- if true, execute the test. This is handy for enabling or
disabling groups of tests in a 'suite' by setting a single property.
Optional, default is true, the test should run.public void execute()
execute
in class org.apache.tools.ant.Task
public java.lang.String getSummary()