river-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Firmstone <j...@zeus.net.au>
Subject QA Test suite refactoring.
Date Sat, 01 Dec 2012 11:24:21 GMT
Presently most tests have a lot of shared mutable state.

This isn't helped by the setup(QAConfig) mutator method in the Test 
interface appended.

An alternative might be:

public Test setup(QAConfig config) throws Exception;

This would allow the test to return another Test object, fully 
constructed with immutable state.

It would also allow the test to create an object that can run several 
other Test objects, rather than relying on inheritance.


 * This interface must implemented by all tests supported by the test
 * harness.  The following sequence of events is performed for each
 * test:
 * <p><ul>
 *   <li> the test class is instantiated and it's no-arg constructor called.
 *        The constructor will typically perform minimal initialization,
 *        since the test does not have access to the test environment
 *   <li> the setup method is called, passing the config object.
 *        This provides an opportunity for performing any test setup
 *        that relies on accessing configuration parameters.
 *   <li> the run method is called to run the test
 *   <li> the teardown method is called to clean up state or services
 *        created by the test. This method is called
 *        even if <code>setup</code> or <code>run</code> throws an

 * </ul>
public interface Test {

     * Failure type. Indicates that a test failed because the product 
     * or an unrecognized environmental failure occured.
    public final static int TEST = 0;
     * Failure type. Indicates that a test failed because of a recognized
     * environmental problem. These will typically be due to
     * intermittent or recurring configuration dependent failures
     * which have been determined to result from problems external
     * to the product.
    public final static int ENV = 1;
     * Failure type. Indicates that a test failed but the reason for
     * failure may be external to the product being tested.
    public final static int INDEF = 2;

    /** Failure type indicating that the test should not be run. */
    public final static int SKIP = 3;

    /** Failure type indicating that the test should be rerun. */
    public final static int RERUN = 4;

    /** Failure type (for analyzers) indicating failure not recognized */
    public final static int UNKNOWN = 5;
     * Failure type indicating no failure occured. This is a special
     * value which should be returned by a FailureAnalyzer to indicate
     * that the exception represents a passing condition for the test
    public final static int PASSED = 6;

     * Performs setup for this test.  If an exception is thrown, the
     * <code>tearDown</code> method will still be called.
     * @param config the test properties
     * @throws Exception if setup fails for any reason
    public void setup(QAConfig config) throws Exception;

     * Execute the body of the test.
     * @throws Exception if the test fails for any reason
    public void run() throws Exception;

     * Tears down any setup that was needed to run the test.  This method is
     * called even if setup throws an exception, and so must be designed to
     * be tolerant of test state that is not completely initialized.
    public void tearDown();

View raw message