public abstract class Script
extends RationalTestScript
Custom scripts invoked via the CallScript Driver Command should get a reference to the topmost executing script which will be a subclass of this org.safs.rational.Script class.
Below is the sample code for such a custom script:
(existing imports) import org.safs.*; import org.safs.rational.*; import org.safs.rational.logging.RLogUtilities; ... public void testMain(Object[] args) { Log.info("Custom Script beginning execution..."); try{ // get reference to SAFS\RFT Hook Script safs = (Script) getScriptCaller(); RLogUtilities safslog = safs.getLogUtilities(); RRobotJHook hook = safs.getRobotJHook(); RTestRecordData testdata = hook.getRTestRecordData(); STAFHelper staf = hook.getHelper(); // do real stuff like getting values from SAFSVARS String value = staf.getVariable("varname"); // sample of writing to the running test log String logname = testdata.getFac(); safslog.logMessage(logname, "CustomScript received varname value:"+ value); safslog.logMessage(logname, "CustomScript changing the varname value to: somevalue"); // do real stuff like setting values in SAFSVARS staf.setVariable("varname", "somevalue"); }catch(Exception x){ Log.error("An error occurred in my custom script:"+ x.getMessage(),x); } } ... Then play with SAFS stuff as much as necessary.
Modifier and Type | Field and Description |
---|---|
protected RRobotJHook |
_hook |
protected RLogUtilities |
_logUtils |
static int |
count |
static int |
info |
Constructor and Description |
---|
Script() |
Modifier and Type | Method and Description |
---|---|
protected IFtVerificationPoint |
Dummy_contentsVP()
Locate and return the verification point Dummy_contents object in the SUT.
|
protected IFtVerificationPoint |
Dummy_contentsVP(TestObject anchor) |
RDDGUIUtilities |
getGuiUtilities()
Used internally and made available to scripts invoked by the CallScript
Driver Commands.
|
RLogUtilities |
getLogUtilities()
Used internally and made available to scripts invoked by the CallScript
Driver Commands.
|
RRobotJHook |
getRobotJHook()
Used internally and made available to scripts invoked by the CallScript
Driver Commands.
|
STAFHelper |
getSTAFHelper()
Used internally and made available to scripts invoked by the CallScript
Driver Commands
|
RTestRecordData |
getTestRecordData()
Used internally and made available to scripts invoked by the CallScript
Driver Commands.
|
static Cell |
localAtCell(Column c,
Row r) |
static Column |
localAtColumn(int i) |
static Column |
localAtColumn(java.lang.String key) |
static Column |
localAtColumn(java.lang.String key,
java.lang.Object val) |
static Column |
localAtColumn(java.lang.String key1,
java.lang.Object val1,
java.lang.String key2,
java.lang.Object val2) |
static Column |
localAtColumn(java.lang.String key1,
java.lang.Object val1,
java.lang.String key2,
java.lang.Object val2,
java.lang.String key3,
java.lang.Object val3) |
static Index |
localAtIndex(int index) |
static List |
localAtPath(java.lang.String path) |
static java.awt.Point |
localAtPoint(int row,
int col) |
static Row |
localAtRow(int i) |
static Row |
localAtRow(java.lang.String key,
java.lang.Object val) |
static Row |
localAtRow(java.lang.String key1,
java.lang.Object val1,
java.lang.String key2,
java.lang.Object val2) |
static Row |
localAtRow(java.lang.String key1,
java.lang.Object val1,
java.lang.String key2,
java.lang.Object val2,
java.lang.String key3,
java.lang.Object val3) |
static Text |
localAtText(java.lang.String name) |
void |
localCallScript(java.lang.String script) |
java.lang.String |
localGetenv(java.lang.String name)
Purpose: Gets the value of an environment variable. |
void |
localLogError(java.lang.String error) |
void |
localLogInfo(java.lang.String info) |
void |
localLogTestResult(java.lang.String message,
boolean passed) |
void |
localLogTestResult(java.lang.String message,
boolean passed,
java.lang.String description) |
void |
localLogWarning(java.lang.String warning) |
ProcessTestObject |
localRun(java.lang.String command,
java.lang.String workingDirectory)
Purpose: Provides the basic command-line execution functionality. |
ProcessTestObject |
localRunJava(java.lang.String main,
java.lang.String classpath,
java.lang.String workingDirectory,
java.lang.String jvm,
java.lang.String jvmOptions)
Starts a Java application with the specified options.
|
void |
localUnregister(java.lang.Object[] testobjects) |
void |
localUnregisterAll() |
IFtVerificationPoint |
localVp(java.lang.String name) |
protected void |
processArgs(java.lang.Object[] args)
Process any -args passed into subclasses storing each as a System.property.
|
void |
testMain(java.lang.Object[] args) |
public static int count
public static int info
protected RRobotJHook _hook
protected RLogUtilities _logUtils
public static List localAtPath(java.lang.String path)
public static Text localAtText(java.lang.String name)
public static java.awt.Point localAtPoint(int row, int col)
public static Cell localAtCell(Column c, Row r)
public static Row localAtRow(int i)
public static Column localAtColumn(int i)
public static Row localAtRow(java.lang.String key, java.lang.Object val)
public static Row localAtRow(java.lang.String key1, java.lang.Object val1, java.lang.String key2, java.lang.Object val2)
public static Row localAtRow(java.lang.String key1, java.lang.Object val1, java.lang.String key2, java.lang.Object val2, java.lang.String key3, java.lang.Object val3)
public static Column localAtColumn(java.lang.String key)
public static Column localAtColumn(java.lang.String key, java.lang.Object val)
public static Column localAtColumn(java.lang.String key1, java.lang.Object val1, java.lang.String key2, java.lang.Object val2)
public static Column localAtColumn(java.lang.String key1, java.lang.Object val1, java.lang.String key2, java.lang.Object val2, java.lang.String key3, java.lang.Object val3)
public static Index localAtIndex(int index)
public IFtVerificationPoint localVp(java.lang.String name)
public void localCallScript(java.lang.String script)
public void localUnregister(java.lang.Object[] testobjects)
public void localUnregisterAll()
public java.lang.String localGetenv(java.lang.String name)
name,
- Stringpublic void localLogInfo(java.lang.String info)
public void localLogWarning(java.lang.String warning)
public void localLogError(java.lang.String error)
public void localLogTestResult(java.lang.String message, boolean passed, java.lang.String description)
public void localLogTestResult(java.lang.String message, boolean passed)
public ProcessTestObject localRun(java.lang.String command, java.lang.String workingDirectory)
command,
- String, the command line to executeworkingDirectory,
- String, The directory that the command should use as its execution contextpublic ProcessTestObject localRunJava(java.lang.String main, java.lang.String classpath, java.lang.String workingDirectory, java.lang.String jvm, java.lang.String jvmOptions)
main
- - The full Java class name of the class to be run. Package and class names must be included.classpath
- - Specifies the classpath that is used to run the main class. If this argument is null, the system classpath environment variable is used.workingDirectory
- - The directory that the command uses as its execution contextjvm
- - The JVM that is used to execute the main classjvmOptions
- - JVM-specific optionspublic RRobotJHook getRobotJHook()
Scripts should get a reference to the topmost executing script which should be a subclass of this org.safs.rational.Script class.
public STAFHelper getSTAFHelper()
Scripts should get a reference to the topmost executing script which should be a subclass of this org.safs.rational.Script class.
public RLogUtilities getLogUtilities()
Scripts should get a reference to the topmost executing script which should be a subclass of this org.safs.rational.Script class.
public RDDGUIUtilities getGuiUtilities()
Scripts should get a reference to the topmost executing script which should be a subclass of this org.safs.rational.Script class.
public RTestRecordData getTestRecordData()
Scripts should get a reference to the topmost executing script which should be a subclass of this org.safs.rational.Script class.
public void testMain(java.lang.Object[] args)
protected void processArgs(java.lang.Object[] args)
args
- -- array of Strings formatted as name=value pairs. If an arg does not
contain "=" then it will be stored as a name=name System.property.protected IFtVerificationPoint Dummy_contentsVP()
protected IFtVerificationPoint Dummy_contentsVP(TestObject anchor)
Copyright © SAS Institute. All Rights Reserved.