public class TATJUnitRunner
extends java.lang.Object
junit.textui.TestRunner,
or JUnit4's JUnitCore, which helps avoid some issues with using JUnit embedded in ALMA TAT scripts.
Note that the intent is not to get rid of the output-based testing that TAT offers, but to complement it with result-based testing as JUnit proposes it, and to make the latter easier in a TAT environment. Both approaches have their merit, so chose one depending on what you want to test.
TATJUnitRunner internally calls JUnitCore#run(Class...), controlling the RunListener output
as well as System.out and System.err.
This class fixes the following issues
JUnitCore produces too much output,
leading to unnecessary maintenance work.TATJUnitRunner produces only very simple fixed output for successful tests,
which means it suppresses
JUnitCore output
System.out
System.err
JUnitCore and TATJUnitRunner
return an exit code 0 to indicate a successful run.
TestRunner reports this in the execution summary,
without giving enough details on the problem, e.g. the assertion
that caused the failure.TATJUnitRunner in this case becomes rather verbose
and dumps on System.err
System.out during test execution
System.err during test execution
JUnitCore and TATJUnitRunner
return an exit code 1 for a failure.
TEST_RUNNER_REPORT success/total: int/int int is replaced by the respective integer number.| Modifier and Type | Class and Description |
|---|---|
static interface |
TATJUnitRunner.KeepTestOutput
Test classes can use this annotation to cause TATJUnitRunner to keep the
tmp files with the stdout, stderr and test output.
|
| Constructor and Description |
|---|
TATJUnitRunner() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(java.lang.String[] args) |
static void |
run(java.lang.Class testClass)
Deprecated.
This method is used for compatibility with the old JUnit-3 based version of this class. It will be removed after ACS 11.2.
|
Result |
runMain(java.lang.Class<?> testClass)
Modified version of
JUnitCore#runMain(JUnitSystem, String...). |
public Result runMain(java.lang.Class<?> testClass)
throws java.io.IOException
JUnitCore#runMain(JUnitSystem, String...).
We restrict ourselves to running only one test class (or suite) at a time.
This method is not thread-safe!testClass - java.io.IOExceptionpublic static void run(java.lang.Class testClass)
throws java.io.FileNotFoundException
java.io.FileNotFoundException - Hack, even other IOException will be wrapped by FileNotFoundException just for temporary backward compatibility.public static void main(java.lang.String[] args)