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,
JUnitTestRunnerdestDir, 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.
|
JUnitTest(java.lang.String name,
boolean haltOnError,
boolean haltOnFailure,
boolean filtertrace,
java.lang.String[] methods,
int thread)
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.
|
int |
getThread()
Get the Ant id of the thread running the test.
|
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, errors, and skipped tests.
|
void |
setCounts(long runs,
long failures,
long errors,
long skips)
Set the number of runs, failures, errors, and skipped tests.
|
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.
|
void |
setThread(int thread)
Set the thread id
|
boolean |
shouldRun(Project p)
Check if this test should run based on the if and unless
attributes.
|
long |
skipCount()
Get the number of skipped tests.
|
addFormatter, getErrorProperty, getFailureProperty, getFiltertrace, getFork, getHaltonerror, getHaltonfailure, getIfCondition, getTodir, getUnlessCondition, isSkipNonTests, setErrorProperty, setFailureProperty, setFiltertrace, setFork, setHaltonerror, setHaltonfailure, setIf, setIf, setSkipNonTests, setTodir, setUnless, setUnlesspublic 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 JUnitTest(java.lang.String name,
boolean haltOnError,
boolean haltOnFailure,
boolean filtertrace,
java.lang.String[] methods,
int thread)
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 methodsthread - Ant thread ID in which test is currently runningpublic 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 setThread(int thread)
thread - the Ant id of the thread running this test
(this is not the system process or thread id)
(this will be 0 in single-threaded mode).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 int getThread()
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.
Kept for backward compatibility with Ant 1.8.4public void setCounts(long runs,
long failures,
long errors,
long skips)
runs - the number of runs.failures - the number of failures.errors - the number of errors.skips - the number of skipped tests.public void setRunTime(long runTime)
runTime - the time in milliseconds.public long runCount()
public long failureCount()
public long errorCount()
public long skipCount()
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