The Artima Developer Community

Drive Your Unit Tests with Custom Scripts
How to Customize Suite Execution by Overriding execute
by Bill Venners
March 10, 2003

<<  Page 5 of 11  >>

Advertisement

Selecting the Script File

Class ScriptDrivenAccountSuite contains two private instance variables:

Here are ScriptDrivenAccountSuite's instance variables:

public class ScriptDrivenAccountSuite extends Suite {

    private static String DEFAULT_SCRIPT_FILE = "script.txt";
    private static String scriptFileName;

    private Account account = new Account();

ScriptDrivenAccountSuite's no-arg constructor sets the scriptFileName to the value of the system property ScriptFile. If ScriptFile is not set, the constructor initializes scriptFileName to its default: "script.txt".

Here's ScriptDrivenAccountSuite's no-arg constructor:

    /**
     * Construct a new <code>ScriptDrivenAccountSuite</code>. If
     * the <code>ScriptFile</code> system property is set, the
     * value of that property will be used as the script file
     * name. Else, <code>script.txt</code> will be used.
     */
    public ScriptDrivenAccountSuite() {
        scriptFileName = System.getProperty("ScriptFile");
        if (scriptFileName == null) {

            scriptFileName = DEFAULT_SCRIPT_FILE;
        }
    }

<<  Page 5 of 11  >>


Sponsored Links




Google
  Web Artima.com   
Copyright © 1996-2007 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us