public abstract class Script
extends com.rational.test.ft.script.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 |
DP_ALL, DP_DEFAULT_EQUIVALENCE_CLASS, DP_SHARE_CURRENT_RECORD
ALT_LEFT, ALT_MIDDLE, ALT_RIGHT, ALT_SHIFT_LEFT, ALT_SHIFT_MIDDLE, ALT_SHIFT_RIGHT, ARROW, BACK_BUTTON, BACKGROUND, BOTTOM_EDGE, CAPTION, CHECK, CHECKBOX, CLOSE_BUTTON, COLLAPSE, COLLAPSE_AND_EXTEND_SELECT, COLLAPSE_AND_SELECT, CONTEXTHELP_BUTTON, CTRL_ALT_LEFT, CTRL_ALT_MIDDLE, CTRL_ALT_RIGHT, CTRL_ALT_SHIFT_LEFT, CTRL_ALT_SHIFT_MIDDLE, CTRL_ALT_SHIFT_RIGHT, CTRL_LEFT, CTRL_MIDDLE, CTRL_RIGHT, CTRL_SHIFT_LEFT, CTRL_SHIFT_MIDDLE, CTRL_SHIFT_RIGHT, DEFAULT, DEFAULT_FLAGS, DESELECT, DESELECT_ALL, DISABLE_LOGGING, DISABLED, DROPDOWN, ENABLE_LOGGING, ENABLED, EXPAND, EXPAND_AND_EXTEND_SELECT, EXPAND_AND_SELECT, EXTEND_SELECT, HEADER_ICON, INDETERMINATE, LEFT, LEFT_EDGE, LOADED, LOADING, LOG_DISABLE_GUI_ACTION, LOG_DISABLE_GUI_SNAPSHOT_ACTION, LOG_ENABLE_GUI_ACTION, LOG_ENABLE_GUI_SNAPSHOT_ACTION, LOG_FAILURES, LOG_FAILURES_WARNINGS, LOG_FAILURES_WARNINGS_PASS, LOG_FAILURES_WARNINGS_PASS_INFO, MAXIMIZE_BUTTON, MAY_EXIT, MIDDLE, MINIMIZE_BUTTON, MONTH, NO_FLAGS, NO_STATE, NOT_SELECTED, NOT_SHOWING, PARENTROWS, PLUS_MINUS, POPUP, READY, RIGHT, RIGHT_EDGE, SCROLL_DOWN, SCROLL_DOWNBUTTON, SCROLL_ELEVATOR, SCROLL_HORIZONTAL_ELEVATOR, SCROLL_LEFT, SCROLL_LEFTBUTTON, SCROLL_LINEDOWN, SCROLL_LINELEFT, SCROLL_LINERIGHT, SCROLL_LINEUP, SCROLL_PAGEDOWN, SCROLL_PAGELEFT, SCROLL_PAGERIGHT, SCROLL_PAGEUP, SCROLL_RIGHT, SCROLL_RIGHTBUTTON, SCROLL_UP, SCROLL_UPBUTTON, SCROLL_VERTICAL_ELEVATOR, SELECT, SELECTED, SHIFT_LEFT, SHIFT_MIDDLE, SHIFT_RIGHT, SHOWHIDE_BUTTON, SHOWING, SINGLE_SELECT, SYSTEM_MENU, THUMB, TODAY, TOP_EDGE, UNCHECK, UNDETERMINED, UNINITIALIZED, VERSION, YEAR
Constructor and Description |
---|
Script() |
Modifier and Type | Method and Description |
---|---|
protected com.rational.test.ft.vp.IFtVerificationPoint |
Dummy_contentsVP()
Locate and return the verification point Dummy_contents object in the SUT.
|
protected com.rational.test.ft.vp.IFtVerificationPoint |
Dummy_contentsVP(com.rational.test.ft.object.interfaces.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 com.rational.test.ft.script.Cell |
localAtCell(com.rational.test.ft.script.Column c,
com.rational.test.ft.script.Row r) |
static com.rational.test.ft.script.Column |
localAtColumn(int i) |
static com.rational.test.ft.script.Column |
localAtColumn(java.lang.String key) |
static com.rational.test.ft.script.Column |
localAtColumn(java.lang.String key,
java.lang.Object val) |
static com.rational.test.ft.script.Column |
localAtColumn(java.lang.String key1,
java.lang.Object val1,
java.lang.String key2,
java.lang.Object val2) |
static com.rational.test.ft.script.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 com.rational.test.ft.script.Index |
localAtIndex(int index) |
static com.rational.test.ft.script.List |
localAtPath(java.lang.String path) |
static java.awt.Point |
localAtPoint(int row,
int col) |
static com.rational.test.ft.script.Row |
localAtRow(int i) |
static com.rational.test.ft.script.Row |
localAtRow(java.lang.String key,
java.lang.Object val) |
static com.rational.test.ft.script.Row |
localAtRow(java.lang.String key1,
java.lang.Object val1,
java.lang.String key2,
java.lang.Object val2) |
static com.rational.test.ft.script.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 com.rational.test.ft.script.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) |
com.rational.test.ft.object.interfaces.ProcessTestObject |
localRun(java.lang.String command,
java.lang.String workingDirectory)
Purpose: Provides the basic command-line execution functionality. |
com.rational.test.ft.object.interfaces.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() |
com.rational.test.ft.vp.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) |
callScript, callScript, callScript, callScript, callScript, callScript, cleanup, derefAll, doesVariablesManagerExist, downloadProjectFiles, dpNext, find, find, getApplications, getBrowsers, getCurrentBrowser, getCurrentJVM, getCurrentProject, getCurrentScriptIterationCount, getDomains, getenv, getJVMs, getLineNumber, getLineNumber, getMap, getMap, getMappedTestObject, getOperatingSystem, getOption, getProject, getProjectByLocation, getRegisteredTestObjects, getRootTestObject, getScreen, getScriptArgs, getScriptCaller, getScriptDefinition, getScriptName, getSimplifiedAction, getSimplifiedScriptLine, getSystemClipboard, getTimerValue, getTopScript, getTopScriptLineNumber, getTopScriptName, getTopWindows, getVariablesManager, getVersion, getVisualScriptTestElements, isApplicationDefined, isBrowserDefined, isJVMDefined, isMainScript, logError, logError, logException, logInfo, logInfo, logTestResult, logTestResult, logWarning, logWarning, objectAtPoint, onAmbiguousRecognition, onCallScriptException, onInitialize, onObjectNotFound, onRecognitionWarning, onRun, onSubitemNotFound, onTerminate, onTestObjectMethodException, onUnexpectedActiveWindow, onUnhandledException, onVpFailure, resetInvocationTimeout, resetOption, resetTOCreationUnregisterCounts, run, runJava, runMain, runMain, runMain, runMain, runMain, runMain, setCurrentBrowser, setCurrentJVM, setCurrentLogFilter, setDatapool, setenv, setInvocationTimeout, setOption, setOption, setOption, setOption, setOption, setOption, setScriptName, setSimplifiedScriptLine, shellExecute, sleep, startApp, startApp, startBrowser, startBrowser, stop, stopTimer, timerStart, timerStop, trimStackTrace, unregister, unregisterAll, unsetenv, updateTOCreationCount, updateTOUnregisterCount, vp, vp, vpDynamic, vpDynamic, vpManual, vpManual
_S, atArea, atButton, atButton, atCell, atCell, atChild, atChild, atChild, atColor, atColumn, atColumn, atColumn, atColumn, atColumn, atColumn, atColumn, atColumnHeader, atDate, atDate, atDescendant, atDescendant, atDescendant, atDPoint, atDPosition, atFile, atFile, atHeader, atHref, atId, atImage, atImage, atIndex, atLink, atLink, atList, atList, atList, atList, atList, atLocation, atModifiers, atName, atName, atPath, atPoint, atPosition, atProperty, atRecognitionIndex, atRow, atRow, atRow, atRow, atRow, atRow, atRow, atRowColumnIndex, atRowHeader, atSeparator, atText, atText, atTextPosition, atToolTipText, atToolTipText, atTopLeftHeader, atValue, atWeek, atWeekDay, delay, keyDown, keyUp, leftMouseButtonDown, leftMouseButtonUp, middleMouseButtonDown, middleMouseButtonUp, mouseMove, mouseWheel, rightMouseButtonDown, rightMouseButtonUp, toScreenPoint
dpBoolean, dpBoolean, dpBoolean, dpByte, dpByte, dpByte, dpChar, dpChar, dpChar, dpCurrent, dpDone, dpDouble, dpDouble, dpDouble, dpFactory, dpFloat, dpFloat, dpFloat, dpInitialization, dpInitialization, dpInitialize, dpInt, dpInt, dpInt, dpLong, dpLong, dpLong, dpReset, dpShort, dpShort, dpShort, dpString, dpString, dpString, dpTermination, dpValue, dpValue, dpValue, getDatapool, setCurrentdp, setDatapool, storeDatapool, unsetDatapool
public static int count
public static int info
protected RRobotJHook _hook
protected RLogUtilities _logUtils
public static com.rational.test.ft.script.List localAtPath(java.lang.String path)
public static com.rational.test.ft.script.Text localAtText(java.lang.String name)
public static java.awt.Point localAtPoint(int row, int col)
public static com.rational.test.ft.script.Cell localAtCell(com.rational.test.ft.script.Column c, com.rational.test.ft.script.Row r)
public static com.rational.test.ft.script.Row localAtRow(int i)
public static com.rational.test.ft.script.Column localAtColumn(int i)
public static com.rational.test.ft.script.Row localAtRow(java.lang.String key, java.lang.Object val)
public static com.rational.test.ft.script.Row localAtRow(java.lang.String key1, java.lang.Object val1, java.lang.String key2, java.lang.Object val2)
public static com.rational.test.ft.script.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 com.rational.test.ft.script.Column localAtColumn(java.lang.String key)
public static com.rational.test.ft.script.Column localAtColumn(java.lang.String key, java.lang.Object val)
public static com.rational.test.ft.script.Column localAtColumn(java.lang.String key1, java.lang.Object val1, java.lang.String key2, java.lang.Object val2)
public static com.rational.test.ft.script.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 com.rational.test.ft.script.Index localAtIndex(int index)
public com.rational.test.ft.vp.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 com.rational.test.ft.object.interfaces.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 com.rational.test.ft.object.interfaces.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 com.rational.test.ft.vp.IFtVerificationPoint Dummy_contentsVP()
protected com.rational.test.ft.vp.IFtVerificationPoint Dummy_contentsVP(com.rational.test.ft.object.interfaces.TestObject anchor)
Copyright © SAS Institute. All Rights Reserved.