satin.testing
Class TestSuite

java.lang.Object
  |
  +--satin.testing.Test
        |
        +--satin.testing.TestProgram
              |
              +--satin.testing.TestSuite

public final class TestSuite
extends TestProgram

Base class for a test suite A TestSuite executes one or more TestPrograms. This class is a standalone executable program and should not be subclassed.

Command-Line Arguments

The TestSuite class recognizes all of the command-line switches recognized by TestProgram.
-suite fileName
Specifies the suite parameter file.

Creating Your Own Test Suite

1. Create a suite parameter file
2. Execute the TestSuite class and pass the suite parameter file with a -suite command line argument.

Suite Parameter Files look like:
Grammatical Spec:
     classType [NEWLOG] className cmdLineArgs

classType can be script or suite
NEWLOG is an optional identifier (see below)
className is the fully qualified class name (as a string) of the class to instantiate and run
cmdLineArgs is a string containing the arguments you would specify on the command line if you ran that class standalone.

Example:

 
 //---------------------------------------------------------------
 //Suite Param File
 //---------------------------------------------------------------
 script		"myScript" 	"-params foo.param -data test.param"
 suite	NEWLOG 	"mySuite" 	"-log o:\myLog -suite suite.param"
 
You run a suite by issuing the following on the command line:

java satin.testing.TestSuite -log myLogFile -suite mySuiteParamFile.param

Where myLog is the name of the log to write the suite output to and suite.param is the file contining the suite parameters (i.e. class and arg list)
Speciying NEWLOG after the script or suite tag will cause the output for that class to go to a new log file.

Case 1: no NEWLOG, -log not present in the arg list = all output in suite log file
Case 2: no NEWLOG, -log present in the arg list = TestProgram should throw an exception
Case 3: NEWLOG present, -log not present in the arg list = all output for this class directed to the "default" log created by TestProgram
Case 4: NEWLOG present, -log present in the arg list = all output for this class output to specified log file

Scripts will be run using the standard constructor which takes TestLog and String[] as its two arguments in that order. Note: the main function will never be executed, only the run method.

Author:
Andy Griffin

Fields inherited from class satin.testing.TestProgram
log
 
Fields inherited from class satin.testing.Test
lastException
 
Constructor Summary
TestSuite(TestLog log, java.lang.String[] cmdLineArgs)
          The constructor.
 
Method Summary
protected void createParams()
          Creates the parameter sets for the test suite
static final TestScript createScriptInstance(java.lang.String className, TestLog theLog, java.lang.String[] cmdLineArgs)
          Creates an instance of a TestScript based on its class name.
static final TestSuite createSuiteInstance(java.lang.String className, TestLog theLog, java.lang.String[] cmdLineArgs)
          Creates an instance of a TestSuite.
protected SuiteParams createSuiteParams()
          Creates the suite parameter set.
protected void defineCmdLineArgs(CmdLineParser p)
          Defines command line arguments.
protected void execute()
          Iterates the class list loaded from the parameter file and runs each TestProgram.
static void main(java.lang.String[] args)
          Entry point to the TestSuite class.
 
Methods inherited from class satin.testing.TestProgram
createLogFile, doSetup, getLog
 
Methods inherited from class satin.testing.Test
cleanup, doCleanup, doExecute, doVerify, run, setup, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestSuite

public TestSuite(TestLog log,
                 java.lang.String[] cmdLineArgs)
          throws java.lang.Exception
The constructor.

Parameters:
log
the log file to append to, or null to create a new one. @see satin.testing.TestProgram
cmdLineArgs
arguments passed to the command line. If there are no command line arguments, you can pass null for this parameter.
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Entry point to the TestSuite class.

execute

protected void execute()
                throws java.lang.Exception
Iterates the class list loaded from the parameter file and runs each TestProgram.

Overrides:
execute in class Test

createScriptInstance

public static final TestScript createScriptInstance(java.lang.String className,
                                                    TestLog theLog,
                                                    java.lang.String[] cmdLineArgs)
                                             throws java.lang.Exception
Creates an instance of a TestScript based on its class name.

Parameters:
className
The fully qualified class to instantiate
theLog
The test log to write the output to
cmdLineArgs
An array of string specifying the command line arguments to this script

createSuiteInstance

public static final TestSuite createSuiteInstance(java.lang.String className,
                                                  TestLog theLog,
                                                  java.lang.String[] cmdLineArgs)
                                           throws java.lang.Exception
Creates an instance of a TestSuite.

Parameters:
className
The fully qualified class to instantiate (for now always satin.testing.TestSuite)
theLog
The test log to write the output to
cmdLineArgs
An array of string specifying the command line arguments to this suite

createParams

protected void createParams()
                     throws ParamError
Creates the parameter sets for the test suite

Overrides:
createParams in class TestProgram

createSuiteParams

protected SuiteParams createSuiteParams()
                                 throws ParamError
Creates the suite parameter set.

defineCmdLineArgs

protected void defineCmdLineArgs(CmdLineParser p)
Description copied from class: TestProgram
Defines command line arguments. You can override this in your derived class to define arguments that are specific to your script. All you need to do is call the appropriate define*** methods of CmdLineParser. If you override this method, be sure to call the inherited method first, before defining your own arguments.

Overrides:
defineCmdLineArgs in class TestProgram
Revision History

7/31/01 Ed Stauff - made changes per code review.

7/30/01 Andy Griffin - touched up UltraEdit/JBuilder formatting and yanked debug print statements

5/31/01 Ed Stauff - moved logBlock from public to private scope.

5/16/01 Andy Griffin - functionality written

4/10/01 Ed Stauff - file created.



Generated on 5/9/2001 19:37 from TestSuite.java (PRIVATE SOURCES)