satin.testing
Class TestScript

java.lang.Object
  |
  +--satin.testing.Test
        |
        +--satin.testing.TestProgram
              |
              +--satin.testing.TestScript
Direct Known Subclasses:
MCtestScript

public abstract class TestScript
extends TestProgram

Base class for a test script. This class, along with the Testcase class, establishes the framework for all test scripts, and provides the following support:

When instantiated (created), a test script performs the following steps:

  1. Handles any command-line arguments that may have been provided.
  2. Creates a log file.
  3. Logs information about the system on which the script is running.
  4. Reads any parameter files that may have been specified.
  5. Calls run to execute the body of the test, which in turn calls:
    a) setup
    b) execute
    c) verify
    d) cleanup
  6. Logs summary information about the script.
  7. Prints a summary to the standard output (console).

Command-Line Arguments

The TestScript class recognizes all of the command-line switches recognized by TestProgram.
-params fileName...
Specifies one or more script parameter files.
-data fileName...
Specifies one or more script data parameter files.

Your script can define and handle its own command-line arguments by overriding the defineCmdLineArgs method.

Creating Your Own Test Script

To create your own test script, use the following boilerplate code, substituting the name of your class for "MY_TEST_SCRIPT":

public class MY_TEST_SCRIPT extends TestScript
 {
 	public MY_TEST_SCRIPT (TestLog log, String args[]) throws Exception
 	{	super(log, args);	}

 	public static void main (String args[]) throws Exception
 	{	(new MY_TEST_SCRIPT(null, args)).run();	}

 	protected void execute () throws Exception
 	{
 		// the body of your test script
 	}
 }

Author:
Ed Stauff

Fields inherited from class satin.testing.TestProgram
log
 
Fields inherited from class satin.testing.Test
lastException
 
Constructor Summary
TestScript(TestLog log, java.lang.String[] cmdLineArgs)
          The constructor.
 
Method Summary
protected final DataParams createDataParamSet()
          Creates the data parameter set.
protected final void createParams()
          Creates the parameter sets for the test script
protected final ScriptParams createScriptParamSet()
          Creates the script parameter set.
protected void defineCmdLineArgs(CmdLineParser p)
          Defines command line arguments.
final DataParams getDataParams()
          Returns the data parameter set for the script.
final ScriptParams getScriptParams()
          Returns the script parameter set for the script.
protected void logSummary()
          Logs summary information about the test script.
protected void printConsoleSummary()
          Prints summary information to the console.
 
Methods inherited from class satin.testing.TestProgram
createLogFile, doSetup, getLog
 
Methods inherited from class satin.testing.Test
cleanup, doCleanup, doExecute, doVerify, execute, run, setup, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestScript

public TestScript(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.
cmdLineArgs
arguments passed to the command line. If there are no command line arguments, you can pass null for this parameter.
Method Detail

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

createParams

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

Overrides:
createParams in class TestProgram

createScriptParamSet

protected final ScriptParams createScriptParamSet()
                                           throws ParamError
Creates the script parameter set.

createDataParamSet

protected final DataParams createDataParamSet()
                                       throws ParamError
Creates the data parameter set.

logSummary

protected void logSummary()
                   throws java.io.IOException
Logs summary information about the test script. This is the final output written to the test log. Override this method to add your own summary information, but be sure to call the inherited method.

printConsoleSummary

protected void printConsoleSummary()
                            throws java.io.IOException
Prints summary information to the console. This is a convenience to the person running the script, so they don't have to look in the test log to get basic summary info. This info is also typically included in the test log, though possibly in a different format.

getScriptParams

public final ScriptParams getScriptParams()
Returns the script parameter set for the script.

getDataParams

public final DataParams getDataParams()
Returns the data parameter set for the script.
Revision History

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

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

5/16/01 Andy Griffin - fixed up parameter stuff

5/15/01 Ed Stauff - changes per 2nd API review.

4/25/01 Ed Stauff - plugged in parameter stuff.

4/10/01 Ed Stauff - broke out TestProgram class.

3/27/01 Ed Stauff - made changes per API review.

3/22/01 - API reviewed by Test Automation team.



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