public class JUnitTest extends BaseTest implements java.lang.Cloneable
Run a single JUnit test.
The JUnit test is actually run by JUnitTestRunner
.
So read the doc comments for that class :)
JUnitTask
,
JUnitTestRunner
destDir, errorProperty, failureProperty, filtertrace, fork, formatters, haltOnError, haltOnFail, ifProperty, unlessProperty
Constructor and Description |
---|
JUnitTest()
No arg constructor.
|
JUnitTest(java.lang.String name)
Constructor with name.
|
JUnitTest(java.lang.String name,
boolean haltOnError,
boolean haltOnFailure,
boolean filtertrace)
Constructor with options.
|
JUnitTest(java.lang.String name,
boolean haltOnError,
boolean haltOnFailure,
boolean filtertrace,
java.lang.String[] methods)
Constructor with options.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
long |
errorCount()
Get the number of errors.
|
long |
failureCount()
Get the number of failures.
|
FormatterElement[] |
getFormatters()
Get the formatters set for this test.
|
java.lang.String |
getName()
Get the name of the test class.
|
java.lang.String |
getOutfile()
Get the name of the output file
|
java.util.Properties |
getProperties()
Get the properties used in the test.
|
long |
getRunTime()
Get the run time.
|
static java.lang.String[] |
parseTestMethodNamesList(java.lang.String methodNames)
Parses a comma-separated list of method names and check their validity.
|
long |
runCount()
Get the number of runs.
|
void |
setCounts(long runs,
long failures,
long errors)
Set the number of runs, failures and errors.
|
void |
setMethods(java.lang.String value)
Sets names of individual test methods to be executed.
|
void |
setName(java.lang.String value)
Set the name of the test class.
|
void |
setOutfile(java.lang.String value)
Set the name of the output file.
|
void |
setProperties(java.util.Hashtable p)
Set the properties to be used in the test.
|
void |
setRunTime(long runTime)
Set the runtime.
|
boolean |
shouldRun(Project p)
Check if this test should run based on the if and unless
attributes.
|
addFormatter, getErrorProperty, getFailureProperty, getFiltertrace, getFork, getHaltonerror, getHaltonfailure, getIfCondition, getTodir, getUnlessCondition, setErrorProperty, setFailureProperty, setFiltertrace, setFork, setHaltonerror, setHaltonfailure, setIf, setIf, setTodir, setUnless, setUnless
public JUnitTest()
public JUnitTest(java.lang.String name)
name
- the name of the test.public JUnitTest(java.lang.String name, boolean haltOnError, boolean haltOnFailure, boolean filtertrace)
name
- the name of the test.haltOnError
- if true halt the tests if there is an error.haltOnFailure
- if true halt the tests if there is a failure.filtertrace
- if true filter stack traces.public JUnitTest(java.lang.String name, boolean haltOnError, boolean haltOnFailure, boolean filtertrace, java.lang.String[] methods)
name
- the name of the test.haltOnError
- if true halt the tests if there is an error.haltOnFailure
- if true halt the tests if there is a failure.filtertrace
- if true filter stack traces.methods
- if non-null run only these test methodspublic void setMethods(java.lang.String value)
value
- comma-separated list of names of individual test methods
to be executed,
or null
if all test methods should be executedpublic void setName(java.lang.String value)
value
- the name to use.public void setOutfile(java.lang.String value)
value
- the name of the output file to use.public static java.lang.String[] parseTestMethodNamesList(java.lang.String methodNames) throws java.lang.IllegalArgumentException
methodNames
- comma-separated list of method names to be parsedjava.lang.IllegalArgumentException
- if the given string is null
or if it is not
a comma-separated list of valid Java identifiers;
an empty string is acceptable and is handled as an empty
listpublic java.lang.String getName()
public java.lang.String getOutfile()
public void setCounts(long runs, long failures, long errors)
runs
- the number of runs.failures
- the number of failures.errors
- the number of errors.public void setRunTime(long runTime)
runTime
- the time in milliseconds.public long runCount()
public long failureCount()
public long errorCount()
public long getRunTime()
public java.util.Properties getProperties()
public void setProperties(java.util.Hashtable p)
p
- the properties.
This is a copy of the projects ant properties.public boolean shouldRun(Project p)
p
- the project to use to check if the if and unless
properties exist in.public FormatterElement[] getFormatters()
public java.lang.Object clone()
clone
in class java.lang.Object