Static Public Member Functions

alma.acs.testsupport.tat.TATJUnitRunner Class Reference

List of all members.

Static Public Member Functions

static void run (Class testClass) throws FileNotFoundException
static void main (String[] args)

Detailed Description

Replacement for junit.textui.TestRunner that 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.

Internally calls TestRunner#doRun(Test), controlling the ResultPrinter output as well as System.out and System.err.

Fixes the following issues

  1. If the tests succeed, TestRunner produces too much output, which forces test developers to provide TAT with reference output files of all successful JUnit test runs, which seems absurd given that JUnit does all error checks already itself.
    TATJUnitRunner produces no output for successful tests, which means it suppresses
    • TestRunners output
    • any other output to System.out
    • any other output to System.err
    Both TestRunner and TATJUnitRunner return an exit code 0 to indicate a successful run.
  2. If a test fails (either JUnit "failure" or "error"), TestRunner reports this in the execution summary, without giving any details on the problem, e.g. the assertion that caused the failure.
    TATJUnitRunner in this case becomes rather verbose and dumps on System.err
    • the detailed TestRunner output using a ResultPrinter.
    • any output to System.out during test execution
    • any output to System.err during test execution
    Both TestRunner and TATJUnitRunner return an exit code 1 for a failure and 2 for an error.

For either failure or success, the following line is printed as the first line to stdout, so that TAT or other tools can analyze how many tests have run, and how many succeeded:
TEST_RUNNER_REPORT success/total: int/int
where int is replaced by the respective integer number.

Author:
hsommer

Member Function Documentation

static void alma.acs.testsupport.tat.TATJUnitRunner.main ( String[]  args  )  [static]
static void alma.acs.testsupport.tat.TATJUnitRunner.run ( Class  testClass  )  throws FileNotFoundException [static]

Runs a suite extracted from a TestCase subclass.

Redirects System.out and System.err so that successful test runs will not produce any output, while in case of failure/error they get dumped to System.err.

Referenced by alma.acs.testsupport.tat.TATJUnitRunner.main().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties