public class Runner extends java.lang.Object implements JSAFSConfiguredClassStore
Constructor and Description |
---|
Runner()
Gain access to the instance interface to a Runner.
|
Modifier and Type | Method and Description |
---|---|
static TestRecordHelper |
action(Component comp,
java.lang.String keyword,
java.lang.String... params)
Run any SAFS ComponentFunction not already in a convenience wrapper routine.
|
static TestRecordHelper |
action(java.lang.String keyword,
java.lang.String child,
java.lang.String parent,
java.lang.String... params)
Run any SAFS ComponentFunction not already in a convenience wrapper routine.
|
void |
addConfiguredClassInstance(java.lang.String classname,
java.lang.Object object)
normally only used internally to store objects as we instantiate them.
|
void |
autorun(java.lang.String[] args)
This is the critical method users would call to commence the automatic
instantiation, configuration, and execution of JSAFSTest methods.
|
static TestRecordHelper |
Click(Component comp,
java.lang.String... params)
A single click on an object.
|
static void |
CloseApplication(java.lang.String appID)
Close an application that was launched with LaunchApplication.
|
static TestRecordHelper |
command(java.lang.String keyword,
java.lang.String... params)
Run any SAFS DriverCommand not already in a convenience wrapper routine.
|
static TestRecordHelper |
ControlClick(Component comp,
java.lang.String... params)
A CTRL-click on an object.
|
static TestRecordHelper |
DoubleClick(Component comp,
java.lang.String... params)
A double click on an object.
|
static Driver |
driver()
retrieve access to the minimalist Driver API, if needed.
|
java.lang.Object |
getConfiguredClassInstance(java.lang.String classname)
When using JSAFS to automatically instantiate, configure, and execute tests
across many classes and packages the user can retrieve those otherwise
unavailable class object instances here.
|
static Runner |
getRunnerInstance()
Get hold of the already running instance of the Runner.
|
static java.lang.String |
GetVariableValue(java.lang.String varName)
Get a single SAFS variable value from the SAFS system.
|
static DriverInterface |
iDriver()
retrieve access to the the active DriverInterface, if needed and available.
|
static TestRecordHelper |
InputCharacters(Component comp,
java.lang.String keys)
Sends keystrokes to the specified component.
|
static TestRecordHelper |
InputKeys(Component comp,
java.lang.String keys)
Sends keystrokes to the specified component.
|
static JSAFSDriver |
jsafs()
Primarily for backward compatibility.
|
static void |
LaunchApplication(java.lang.String appID,
java.lang.String executable,
java.lang.String... optionals)
Identify and Launch a specified application.
|
static void |
logFAILED(java.lang.String message,
java.lang.String detail)
Log a FAILED message to the current test log.
|
static void |
logGENERIC(java.lang.String message,
java.lang.String detail)
Log a GENERIC message to the current test log.
|
static void |
logPASSED(java.lang.String message,
java.lang.String detail)
Log a PASSED message to the current test log.
|
static void |
Pause(int seconds)
Pause the test the specified number of seconds.
|
static TestRecordHelper |
RightClick(Component comp,
java.lang.String... params)
A single RightClick on an object.
|
static TestRecordHelper |
Select(Component list,
java.lang.String... text)
Set the value of a supported EditBox or TextField.
|
static void |
SetApplicationMap(java.lang.String mapName)
Provide the Application Map for the test to use.
|
static TestRecordHelper |
SetTextValue(Component textfield,
java.lang.String... text)
Set the value of a supported EditBox or TextField.
|
static TestRecordHelper |
SetUnverifiedTextCharacters(Component textfield,
java.lang.String... text)
Set the value of a supported EditBox or TextField.
|
static void |
SetVariableValue(java.lang.String varName,
java.lang.String varValue)
Sets a single SAFS variable value for use by the SAFS system.
|
static TestRecordHelper |
SetVariableValues(java.lang.String... expressions)
Sets one or more SAFS variable values for use by the SAFS system.
|
static void |
shutdown()
Will invoke the Driver shutdown mechanism--which includes the shutdown of JSAFS.
|
static TestRecordHelper |
VerifyProperty(Component comp,
java.lang.String propertyName,
java.lang.String expectedValue,
boolean isCaseSensitive)
Verify the value of a property on the component.
|
static TestRecordHelper |
VerifyPropertyContains(Component comp,
java.lang.String propertyName,
java.lang.String substringValue,
boolean isCaseSensitive)
Verify the value of a property on the component contains a specific substring (partial match).
|
static TestRecordHelper |
VerifyValueContains(java.lang.String value,
java.lang.String substring)
Verify the value contains the substring.
|
static TestRecordHelper |
VerifyValueDoesNotContain(java.lang.String value,
java.lang.String substring)
Verify the value does NOT contain the substring.
|
static TestRecordHelper |
VerifyValues(java.lang.String value1,
java.lang.String value2)
Verify that two string values are equal.
|
static TestRecordHelper |
VerifyValuesNotEqual(java.lang.String value1,
java.lang.String value2)
Verify that two string values are NOT equal.
|
public Runner()
getRunnerInstance()
instead.getRunnerInstance()
public static void shutdown() throws java.lang.Exception
java.lang.Exception
Driver.shutdownJSAFS()
public static Runner getRunnerInstance()
public static Driver driver()
Driver.beforeAll()
public static JSAFSDriver jsafs()
iDriver()
public static DriverInterface iDriver()
public java.lang.Object getConfiguredClassInstance(java.lang.String classname)
getConfiguredClassInstance
in interface JSAFSConfiguredClassStore
classname
- -- the full package name of the class to retrieve.
ex: my.test.package.MyTestpublic void addConfiguredClassInstance(java.lang.String classname, java.lang.Object object)
addConfiguredClassInstance
in interface JSAFSConfiguredClassStore
classname
- -- the full path case-sensitive Class name that was used to
instantiate the object.object
- -- the object that was instantiated and used for processing.public static void logGENERIC(java.lang.String message, java.lang.String detail)
message
- detail
- JSAFSDriver.logGENERIC(String, String)
public static void logPASSED(java.lang.String message, java.lang.String detail)
message
- detail
- JSAFSDriver.logPASSED(String, String)
public static void logFAILED(java.lang.String message, java.lang.String detail)
message
- detail
- JSAFSDriver.logFAILED(String, String)
public void autorun(java.lang.String[] args) throws java.lang.Throwable
Minimalist example:
public static void main(String[] args)throws Throwable{ MyTestApp app = new MyTestApp(); new Runner().autorun(args); ... Runner.shutdown(); }
Automatic configuration and usage is not required. The user can control test configuration and execution within their custom code if they want.
args
- passed in from command-line Java-- the primordial main(String[] args)java.lang.Throwable
JSAFSTest
public static TestRecordHelper action(java.lang.String keyword, java.lang.String child, java.lang.String parent, java.lang.String... params) throws java.lang.Throwable
Ex:
result = Runner.action("GetGUIImage", "ChildX", "MainWin", "ChildXImage.png");
keyword
- child
- parent
- params
- java.lang.Throwable
public static TestRecordHelper action(Component comp, java.lang.String keyword, java.lang.String... params) throws java.lang.Throwable
Run any SAFS ComponentFunction not already in a convenience wrapper routine.result = Runner.action(AppMap.MainWin.ChildComp, "GetGUIImage", "ChildXImage.png");
If any param value contains any spaces, special characters, or expression operators then double-quotes should be embedded to surround the string to avoid expression processing.
Ex: "\"a + b = c \""
keyword
- child
- parent
- params
- java.lang.Throwable
public static TestRecordHelper command(java.lang.String keyword, java.lang.String... params) throws java.lang.Throwable
Run any SAFS DriverCommand not already in a convenience wrapper routine.result = Runner.command("Pause", "10");
If any param value contains any spaces, special characters, or expression operators then double-quotes should be embedded to surround the string to avoid expression processing.
Ex: "\"a + b = c \""
keyword
- child
- parent
- params
- java.lang.Throwable
public static TestRecordHelper SetVariableValues(java.lang.String... expressions) throws java.lang.Throwable
Ex:
results = SetVariableValues("^safsVarName = Value"); results = SetVariableValues("^safsVarName = "+ javaVarReference); results = SetVariableValues("^safsVarName = ^otherSafsVar & "+ javaVarReference); results = SetVariableValues("^safsVarName = ^safsVarNumber + "+ javaVarNumber); results = SetVariableValues("^safsVarName = \"a + b = c\"");
expressions
- If an expression contains any spaces, special characters, or expression operators
that should be considered as literal text then double-quotes should be embedded to surround the
literal text portions of the expression.java.lang.Throwable
SetVariableValue(String, String)
,
GetVariableValue(String)
public static void Pause(int seconds) throws java.lang.Throwable
seconds
- The number of seconds to PAUSE the test before automatically resuming.java.lang.Throwable
public static void SetApplicationMap(java.lang.String mapName) throws java.lang.Throwable
mapName
- - The name of the text-based runtime AppMap to load (not the Java Map class that might be used in code).java.lang.Throwable
public static void LaunchApplication(java.lang.String appID, java.lang.String executable, java.lang.String... optionals) throws java.lang.Throwable
appID
- -- id for this app to use in CloseApplication.executable
- -- The path and filename to the executable OR an ApplicationConstant.optionals
- -- if used must be specified in proper order.java.lang.Throwable
CloseApplication(String)
public static void CloseApplication(java.lang.String appID) throws java.lang.Throwable
appID
- java.lang.Throwable
LaunchApplication(String, String, String...)
public static void SetVariableValue(java.lang.String varName, java.lang.String varValue) throws java.lang.Throwable
varName
- varValue
- java.lang.Throwable
GetVariableValue(String)
,
SetVariableValues(String...)
public static java.lang.String GetVariableValue(java.lang.String varName) throws java.lang.Throwable
varName
- java.lang.Throwable
SetVariableValue(String, String)
,
SetVariableValues(String...)
public static TestRecordHelper VerifyValues(java.lang.String value1, java.lang.String value2) throws java.lang.Throwable
value1
- -- case-sensitive value to compare.value2
- -- case-sensitive value to compare.java.lang.Throwable
public static TestRecordHelper VerifyValuesNotEqual(java.lang.String value1, java.lang.String value2) throws java.lang.Throwable
value1
- -- case-sensitive value to compare.value2
- -- case-sensitive value to compare.java.lang.Throwable
public static TestRecordHelper VerifyValueContains(java.lang.String value, java.lang.String substring) throws java.lang.Throwable
value
- -- case-sensitive value to compare.substring
- -- case-sensitive substring to seek.java.lang.Throwable
public static TestRecordHelper VerifyValueDoesNotContain(java.lang.String value, java.lang.String substring) throws java.lang.Throwable
value
- -- case-sensitive value to compare.substring
- -- case-sensitive substring to seek.java.lang.Throwable
public static TestRecordHelper InputKeys(Component comp, java.lang.String keys) throws java.lang.Throwable
Sends keystrokes to the specified component. Some Special Characters: {Enter}= ENTER key {Tab} = TAB key ^ = CONTROL Key with another key ( "^S" = CONTROL + s) %= ALT Key with another key ("%F" = ALT + F) + = SHIFT key with another key ("+{Enter}" = SHIFT + ENTER)
Component
- to receive keystrokes.keys
- String of keystrokes to send.
If the value contains any spaces, special characters, or expression operators
then double-quotes should be embedded to surround the string to avoid expression processing.java.lang.Throwable
public static TestRecordHelper InputCharacters(Component comp, java.lang.String keys) throws java.lang.Throwable
Sends keystrokes to the specified component. No handling of special characters is performed with the keystrokes.
Component
- to receive keystrokes.keys
- String of keystrokes to send.
If the value contains any spaces, special characters, or expression operators
then double-quotes should be embedded to surround the string to avoid expression processing.java.lang.Throwable
public static TestRecordHelper VerifyProperty(Component comp, java.lang.String propertyName, java.lang.String expectedValue, boolean isCaseSensitive) throws java.lang.Throwable
comp
- -- Component to check for the property value.propertyName
- -- case-sensitive name of the property.expectedValue
- -- value expected to be found.
If the value contains any spaces, special characters, or expression operators
then double-quotes should be embedded to surround the string to avoid expression processing.isCaseSensitive
- -- whether the expectedValue comparison is case-sensitive, or not.java.lang.Throwable
public static TestRecordHelper VerifyPropertyContains(Component comp, java.lang.String propertyName, java.lang.String substringValue, boolean isCaseSensitive) throws java.lang.Throwable
comp
- -- Component to check for the property value.propertyName
- -- case-sensitive name of the property.substringValue
- -- substring value expected to be found.
If the value contains any spaces, special characters, or expression operators
then double-quotes should be embedded to surround the string to avoid expression processing.isCaseSensitive
- -- whether the substringValue comparison is case-sensitive, or not.java.lang.Throwable
public static TestRecordHelper SetTextValue(Component textfield, java.lang.String... text) throws java.lang.Throwable
textfield
- -- Editable Component to change the value on.text
- -- text to set.
If the value contains any spaces, special characters, or expression operators
then double-quotes should be embedded to surround the string to avoid expression processing.java.lang.Throwable
public static TestRecordHelper SetUnverifiedTextCharacters(Component textfield, java.lang.String... text) throws java.lang.Throwable
Set the value of a supported EditBox or TextField. No verification is performed on the value after it has been set.
textfield
- -- Editable Component to change the value on.text
- -- text to set.
If the value contains any spaces, special characters, or expression operators
then double-quotes should be embedded to surround the string to avoid expression processing.java.lang.Throwable
public static TestRecordHelper Select(Component list, java.lang.String... text) throws java.lang.Throwable
Set the value of a supported EditBox or TextField. No verification is performed on the value after it has been set.
list
- -- ComboBox or List Component to change the value on.text
- -- text to set.
If the value contains any spaces, special characters, or expression operators
then double-quotes should be embedded to surround the string to avoid expression processing.java.lang.Throwable
public static TestRecordHelper Click(Component comp, java.lang.String... params) throws java.lang.Throwable
A single click on an object. By default, clicks on the center of the component. We can also click on any part of an object, or any point relative to an object based on a provided x,y coordinate or other component-specific parameters. The object to be clicked is first given context and then a click is generated at the coordinates. Thus, a subitem or object can be referenced by name even though it is only recognized via coordinates. The coordinate lookup is done in the App Map using the child component name AND the first item in the optional String params. If not passing any optional params then the params should be null-- (String[])null. Typical SAFS Data Table records: (1) t MainWindow MainWindow Click (2) t MainWindow MainWindow Click AnObject (3) t MainWindow FolderTree Click Node1 (4) t MainWindow MainWindow Click "50 200" (5) t MainWindow MainWindow Click "Coords=50 200" Matching Runner invocations: (1) Runner.Click(AppMap.MainWindow.MainWindow, null); (2) Runner.Click(AppMap.MainWindow.MainWindow, "AnObject"); (3) Runner.Click(AppMap.MainWindow.FolderTree, "Node1"); (4) Runner.Click(AppMap.MainWindow.MainWindow, "50;200"; (5) Runner.Click(AppMap.MainWindow.MainWinow, "Coords=50;200"; #2 above will expect the AppMap to contain an AnObject="3,10" entry in the MainWindow section of the currently active AppMap to click at x=3, y=10 in the MainWindow. #3 above will contain a FolderTree entry in the MainWindow section with normal recognition information for FolderTree. There will also be a separate FolderTree section in the AppMap in which there will be an entry like Node1="15 30". This will tell the automation to locate the FolderTree Generic object and click at the coordinates specified by the AppMap reference. #4 and #5 above show using literal text instead of an AppMap entry to specify where to click relative to the item. Note the use of the "Coords=" prefix on the value is optional. Engines should also attempt to support coordinates separated by alternate separators. The most common separators that should be supported would be: "," (comma) Example: "50,200" ";" (semi-colon) Example: "50;200" " " (space) Example: "50 200" Note: the TID supports this command using Image-Based Testing techniques. For IOS: Any optional coordinates MUST be specified as an integer number between 0-100. 0 represents the extreme left (or top), while 100 represents the extreme right (or bottom). IOS does not use absolute coordinates, but relative coordinates representing a percentage of the element width or height.
Component
- Optional:NO
A Component reference to the child component to be clicked. The Component reference should have the
embedded Component reference to its parent.params
- Optional:YES
Should be null:(String[])null if not passing any parametersappMapSubkey
- Optional:YES
Name of the AppMap subkey for lookup or the literal text to use for the click.java.lang.Throwable
public static TestRecordHelper RightClick(Component comp, java.lang.String... params) throws java.lang.Throwable
A single RightClick on an object. By default, clicks on the center of the component. We can also click on any part of an object, or any point relative to an object based on a provided x,y coordinate or other component-specific parameters. The object to be clicked is first given context and then a click is generated at the coordinates. Thus, a subitem or object can be referenced by name even though it is only recognized via coordinates. The coordinate lookup is done in the App Map using the child component name AND the first item in the optional String params. If not passing any optional params then the params should be null-- (String[])null. Typical SAFS Data Table records: (1) t MainWindow MainWindow RightClick (2) t MainWindow MainWindow RightClick AnObject (3) t MainWindow FolderTree RightClick Node1 (4) t MainWindow MainWindow RightClick "50 200" (5) t MainWindow MainWindow RightClick "Coords=50 200" Matching Runner invocations: (1) Runner.RightClick(AppMap.MainWindow.MainWindow, null); (2) Runner.RightClick(AppMap.MainWindow.MainWindow, "AnObject"); (3) Runner.RightClick(AppMap.MainWindow.FolderTree, "Node1"); (4) Runner.RightClick(AppMap.MainWindow.MainWindow, "50;200"; (5) Runner.RightClick(AppMap.MainWindow.MainWinow, "Coords=50;200"; #2 above will expect the AppMap to contain an AnObject="3,10" entry in the MainWindow section of the currently active AppMap to click at x=3, y=10 in the MainWindow. #3 above will contain a FolderTree entry in the MainWindow section with normal recognition information for FolderTree. There will also be a separate FolderTree section in the AppMap in which there will be an entry like Node1="15 30". This will tell the automation to locate the FolderTree Generic object and click at the coordinates specified by the AppMap reference. #4 and #5 above show using literal text instead of an AppMap entry to specify where to click relative to the item. Note the use of the "Coords=" prefix on the value is optional. Engines should also attempt to support coordinates separated by alternate separators. The most common separators that should be supported would be: "," (comma) Example: "50,200" ";" (semi-colon) Example: "50;200" " " (space) Example: "50 200" Note: the TID supports this command using Image-Based Testing techniques. For IOS: Any optional coordinates MUST be specified as an integer number between 0-100. 0 represents the extreme left (or top), while 100 represents the extreme right (or bottom). IOS does not use absolute coordinates, but relative coordinates representing a percentage of the element width or height.
Component
- Optional:NO
A Component reference to the child component to be clicked. The Component reference should have the
embedded Component reference to its parent.String[]
- Optional:YES
Should be null:(String[])null if not passing any parametersappMapSubkey
- Optional:YES
Name of the AppMap subkey for lookup or the literal text to use for the click.java.lang.Throwable
public static TestRecordHelper ControlClick(Component comp, java.lang.String... params) throws java.lang.Throwable
A CTRL-click on an object. By default, clicks on the center of the component. We can also click on any part of an object, or any point relative to an object based on a provided x,y coordinate or other component-specific parameters. The object to be clicked is first given context and then a click is generated at the coordinates. Thus, a subitem or object can be referenced by name even though it is only recognized via coordinates. The coordinate lookup is done in the App Map using the child component name AND the first item in the optional String params. If not passing any optional params then the params should be null-- (String[])null. Typical SAFS Data Table records: (1) t MainWindow MainWindow CtrlClick (2) t MainWindow MainWindow CtrlClick AnObject (3) t MainWindow FolderTree CtrlClick Node1 (4) t MainWindow MainWindow CtrlClick "50 200" (5) t MainWindow MainWindow Click "Coords=50 200" Matching Runner invocations: (1) Runner.ControlClick(AppMap.MainWindow.MainWindow, null); (2) Runner.ControlClick(AppMap.MainWindow.MainWindow, "AnObject"); (3) Runner.ControlClick(AppMap.MainWindow.FolderTree, "Node1"); (4) Runner.ControlClick(AppMap.MainWindow.MainWindow, "50;200"; (5) Runner.ControlClick(AppMap.MainWindow.MainWinow, "Coords=50;200"; #2 above will expect the AppMap to contain an AnObject="3,10" entry in the MainWindow section of the currently active AppMap to click at x=3, y=10 in the MainWindow. #3 above will contain a FolderTree entry in the MainWindow section with normal recognition information for FolderTree. There will also be a separate FolderTree section in the AppMap in which there will be an entry like Node1="15 30". This will tell the automation to locate the FolderTree Generic object and click at the coordinates specified by the AppMap reference. #4 and #5 above show using literal text instead of an AppMap entry to specify where to click relative to the item. Note the use of the "Coords=" prefix on the value is optional. Engines should also attempt to support coordinates separated by alternate separators. The most common separators that should be supported would be: "," (comma) Example: "50,200" ";" (semi-colon) Example: "50;200" " " (space) Example: "50 200" Note: the TID supports this command using Image-Based Testing techniques. For IOS: Any optional coordinates MUST be specified as an integer number between 0-100. 0 represents the extreme left (or top), while 100 represents the extreme right (or bottom). IOS does not use absolute coordinates, but relative coordinates representing a percentage of the element width or height.
Component
- Optional:NO
A Component reference to the child component to be clicked. The Component reference should have the
embedded Component reference to its parent.String[]
- Optional:YES
Should be null:(String[])null if not passing any parametersappMapSubkey
- Optional:YES
Name of the AppMap subkey for lookup or the literal text to use for the click.java.lang.Throwable
public static TestRecordHelper DoubleClick(Component comp, java.lang.String... params) throws java.lang.Throwable
A double click on an object. By default, clicks on the center of the component. We can also click on any part of an object, or any point relative to an object based on a provided x,y coordinate or other component-specific parameters. The object to be clicked is first given context and then a click is generated at the coordinates. Thus, a subitem or object can be referenced by name even though it is only recognized via coordinates. The coordinate lookup is done in the App Map using the child component name AND the first item in the optional String params. If not passing any optional params then the params should be null-- (String[])null. Typical SAFS Data Table records: (1) t MainWindow MainWindow DoubleClick (2) t MainWindow MainWindow DoubleClick AnObject (3) t MainWindow FolderTree DoubleClick Node1 (4) t MainWindow MainWindow DoubleClick "50 200" (5) t MainWindow MainWindow DoubleClick "Coords=50 200" Matching Runner invocations: (1) Runner.DoubleClick(AppMap.MainWindow.MainWindow, null); (2) Runner.DoubleClick(AppMap.MainWindow.MainWindow, "AnObject"); (3) Runner.DoubleClick(AppMap.MainWindow.FolderTree, "Node1"); (4) Runner.DoubleClick(AppMap.MainWindow.MainWindow, "50;200"; (5) Runner.DoubleClick(AppMap.MainWindow.MainWinow, "Coords=50;200"; #2 above will expect the AppMap to contain an AnObject="3,10" entry in the MainWindow section of the currently active AppMap to click at x=3, y=10 in the MainWindow. #3 above will contain a FolderTree entry in the MainWindow section with normal recognition information for FolderTree. There will also be a separate FolderTree section in the AppMap in which there will be an entry like Node1="15 30". This will tell the automation to locate the FolderTree Generic object and click at the coordinates specified by the AppMap reference. #4 and #5 above show using literal text instead of an AppMap entry to specify where to click relative to the item. Note the use of the "Coords=" prefix on the value is optional. Engines should also attempt to support coordinates separated by alternate separators. The most common separators that should be supported would be: "," (comma) Example: "50,200" ";" (semi-colon) Example: "50;200" " " (space) Example: "50 200" Note: the TID supports this command using Image-Based Testing techniques. For IOS: Any optional coordinates MUST be specified as an integer number between 0-100. 0 represents the extreme left (or top), while 100 represents the extreme right (or bottom). IOS does not use absolute coordinates, but relative coordinates representing a percentage of the element width or height.
Component
- Optional:NO
A Component reference to the child component to be clicked. The Component reference should have the
embedded Component reference to its parent.String[]
- Optional:YES
Should be null:(String[])null if not passing any parametersappMapSubkey
- Optional:YES
Name of the AppMap subkey for lookup or the literal text to use for the click.java.lang.Throwable
Copyright © SAS Institute. All Rights Reserved.