public class JUnitTestRunner extends java.lang.Object implements JUnitTaskMirror.JUnitTestRunnerMirror
<code>
public static junit.framework.Test suite()
</code>
If no such method exists, all public methods starting with "test" and taking no argument will be run.
Summary output is generated at the end.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
suppressJunitTenant |
ERRORS, FAILURES, IGNORED_FILE_NAME, SUCCESS| Constructor and Description |
|---|
JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure)
Constructor for fork=true or when the user hasn't specified a classpath.
|
JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure,
boolean showOutput)
Constructor for fork=true or when the user hasn't specified a classpath.
|
JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure,
boolean showOutput,
boolean logTestListenerEvents)
Constructor for fork=true or when the user hasn't specified a classpath.
|
JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure,
boolean showOutput,
boolean logTestListenerEvents,
java.lang.ClassLoader loader,
boolean suppressJunitTenant)
Constructor to use when the user has specified a classpath.
|
JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure,
boolean showOutput,
java.lang.ClassLoader loader)
Constructor to use when the user has specified a classpath.
|
JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure,
java.lang.ClassLoader loader)
Constructor to use when the user has specified a classpath.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addError(Test test,
java.lang.Throwable t)
Interface TestListener.
|
void |
addFailure(Test test,
AssertionFailedError t)
Interface TestListener for JUnit > 3.4.
|
void |
addFailure(Test test,
java.lang.Throwable t)
Interface TestListener for JUnit <= 3.4.
|
void |
addFormatter(JUnitResultFormatter f)
Add a formatter.
|
void |
addFormatter(JUnitTaskMirror.JUnitResultFormatterMirror f)
Add a formatter to the test.
|
void |
endTest(Test test)
Interface TestListener.
|
static java.lang.String |
filterStack(java.lang.String stack)
Filters stack frames from internal JUnit and Ant classes
|
static java.lang.String |
getFilteredTrace(java.lang.Throwable t)
Returns a filtered stack trace.
|
int |
getRetCode()
Returns what System.exit() would return in the standalone version.
|
void |
handleErrorFlush(java.lang.String output)
Handle output sent to System.err.
|
void |
handleErrorOutput(java.lang.String output)
Handle output sent to System.err.
|
void |
handleFlush(java.lang.String output)
Handle output sent to System.out.
|
int |
handleInput(byte[] buffer,
int offset,
int length)
Handle input.
|
void |
handleOutput(java.lang.String output)
Handle a string destined for standard output.
|
static void |
main(java.lang.String[] args)
Entry point for standalone (forked) mode.
|
void |
run()
Run the test.
|
void |
setPermissions(org.apache.tools.ant.types.Permissions permissions)
Permissions for the test run.
|
void |
startTest(Test t)
Interface TestListener.
|
public JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure)
test - the test to run.haltOnError - whether to stop the run if an error is found.filtertrace - whether to filter junit.*.* stack frames out of exceptionshaltOnFailure - whether to stop the run if failure is found.public JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure,
boolean showOutput)
test - the test to run.haltOnError - whether to stop the run if an error is found.filtertrace - whether to filter junit.*.* stack frames out of exceptionshaltOnFailure - whether to stop the run if failure is found.showOutput - whether to send output to System.out/.err as well as formatters.public JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure,
boolean showOutput,
boolean logTestListenerEvents)
test - the test to run.haltOnError - whether to stop the run if an error is found.filtertrace - whether to filter junit.*.* stack frames out of exceptionshaltOnFailure - whether to stop the run if failure is found.showOutput - whether to send output to System.out/.err as well as formatters.logTestListenerEvents - whether to print TestListener events.public JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure,
java.lang.ClassLoader loader)
test - the test to run.haltOnError - whether to stop the run if an error is found.filtertrace - whether to filter junit.*.* stack frames out of exceptionshaltOnFailure - whether to stop the run if failure is found.loader - the classloader to use running the test.public JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure,
boolean showOutput,
java.lang.ClassLoader loader)
test - the test to run.haltOnError - whether to stop the run if an error is found.filtertrace - whether to filter junit.*.* stack frames out of exceptionshaltOnFailure - whether to stop the run if failure is found.showOutput - whether to send output to System.out/.err as well as formatters.loader - the classloader to use running the test.public JUnitTestRunner(java.lang.String platformHome,
java.lang.String classpath,
java.lang.String webClasspath,
JUnitTest test,
boolean haltOnError,
boolean filtertrace,
boolean haltOnFailure,
boolean showOutput,
boolean logTestListenerEvents,
java.lang.ClassLoader loader,
boolean suppressJunitTenant)
test - the test to run.haltOnError - whether to stop the run if an error is found.filtertrace - whether to filter junit.*.* stack frames out of exceptionshaltOnFailure - whether to stop the run if failure is found.showOutput - whether to send output to System.out/.err as well as formatters.logTestListenerEvents - whether to print TestListener events.loader - the classloader to use running the test.suppressJunitTenant - whether junit tenant should be started or notpublic void run()
run in interface JUnitTaskMirror.JUnitTestRunnerMirrorpublic int getRetCode()
getRetCode in interface JUnitTaskMirror.JUnitTestRunnerMirrorpublic void startTest(Test t)
t - the test.public void endTest(Test test)
test - the test.public void addFailure(Test test,
java.lang.Throwable t)
test - the test.t - the exception thrown by the test.public void addFailure(Test test,
AssertionFailedError t)
test - the test.t - the assertion thrown by the test.public void addError(Test test,
java.lang.Throwable t)
test - the test.t - the error thrown by the test.public void setPermissions(org.apache.tools.ant.types.Permissions permissions)
setPermissions in interface JUnitTaskMirror.JUnitTestRunnerMirrorpermissions - the permissions to use.public void handleOutput(java.lang.String output)
handleOutput in interface JUnitTaskMirror.JUnitTestRunnerMirroroutput - the string to outputpublic int handleInput(byte[] buffer,
int offset,
int length)
throws java.io.IOException
handleInput in interface JUnitTaskMirror.JUnitTestRunnerMirrorbuffer - not used.offset - not used.length - not used.java.io.IOException - never.Task.handleInput(byte[], int, int)public void handleErrorOutput(java.lang.String output)
handleErrorOutput in interface JUnitTaskMirror.JUnitTestRunnerMirroroutput - output for System.errpublic void handleFlush(java.lang.String output)
handleFlush in interface JUnitTaskMirror.JUnitTestRunnerMirroroutput - output for System.out.public void handleErrorFlush(java.lang.String output)
handleErrorFlush in interface JUnitTaskMirror.JUnitTestRunnerMirroroutput - coming from System.errpublic void addFormatter(JUnitResultFormatter f)
f - the formatter to add.public void addFormatter(JUnitTaskMirror.JUnitResultFormatterMirror f)
addFormatter in interface JUnitTaskMirror.JUnitTestRunnerMirrorf - the formatter to use.public static void main(java.lang.String[] args)
throws java.io.IOException
| key | description | default value |
|---|---|---|
| haltOnError | halt test on errors? | false |
| haltOnFailure | halt test on failures? | false |
| formatter | A JUnitResultFormatter given as classname,filename. If filename is ommitted, System.out is assumed. | none |
| showoutput | send output to System.err/.out as well as to the formatters? | false |
| logtestlistenerevents | log TestListener events to System.out. | false |
args - the command line arguments.java.io.IOException - on error.public static java.lang.String getFilteredTrace(java.lang.Throwable t)
t - the exception to filter.public static java.lang.String filterStack(java.lang.String stack)
stack - the stack trace to filter.Copyright © 2018 SAP SE. All Rights Reserved.