SilkTest Agents
One Agent can run locally on the host machine. In a networked environment, any number of Agents can run on remote machines.
SilkTest Classic provides two types of Agents, the Open Agent and the Classic Agent.
When you record a test with the Open Agent set as the default agent, SilkTest Classic includes a locator to identify the top-most window of the test application.
SilkTest Classic determines which Agent to use by detecting whether a locator or Find or FindAll commond is used. If no locator or Find or FindAll command is present, SilkTest Classic uses the Classic Agent.
In earlier releases, the TAG_IS_OPEN_AGENT tag was defined on the root window declaration of a control hierarchy to identify that the Open Agent should be used. This is no longer necessary. When a window declaration contains both locators and tags and either could be used for resolving the window, check or uncheck the Prefer Locator check box in the General Options dialog box to determine which method is used.
SilkTest Agents>Setting the Default Agent
You can create a script that uses the Classic Agent and the Open Agent. Recording primarily depends on the default agent while replaying the script primarily depends on the window declaration of the underlying control. If you create a script that does not use window declarations, the default agent is used to reply the script.
You can also use the function Connect ([sMachine, sAgentType]) in a script to connect a machine explicitly with either Classic or Open Agent. Using the connect function changes the default Agent temporarily for the current test case, but it does not change the default Agent of your project. However, this does not override the Agent that is used for replay, which is defined by the window declaration.
The Open Agent provides the majority of the same record capabilities as the Classic Agent and the same replay capabilities.
Using the Recording Options dialog box you can:
- Set recording preferences;
- Set recording options for xBrowser;
- Set custom attributes to use in locators;
- Set classes to ignore;
- Set WPF classes to expose during recording and playback;
- Set xBrowser synchronization options;
- Set replay options.
Manually Setting the Window Timeout Value:
Add the following to the script: Agent.Setoption (OPT_WINDOW_TIMEOUT, numberOfSeconds)
The default port of the information service is 22901. By default, the information service uses ports 2966, 11998, and 11999 as alternate ports.
Differences in Object Recognition Between the Classic Agent and the Open Agent
When recording and executing test cases, the Classic Agent uses the keywords tag or multitag in a window declaration to uniquely identify an object in the test application. The tag is the actual name, as opposed to the identifier, which is the logical name.
When using the Open Agent, you typically use dynamic object recognition with a Find or FindAll function and an xPath query to locate objects in your test application. To make calls that use window declarations using the Open Agent, you must use the keyword locator in your window declarations.
Example:
Caption |
|
Classic Agent tag “<caption string>” |
Open Agent locator “//<class name>[@caption=’<caption string>’]” |
Note: For convenience, you can use shortened forms for the Xpath locator strings. SilkTest Classic automatically expands the syntax to use full Xpath strings when you run a script.
You can omit:
- The hierarchy separator, “.//”. SilkTest Classic defaults to “//”.
- The class name. SilkTest Classic defaults to the class name of the window that contains the locator.
- The surrounding square brackets of the attributes, “[ ]”.
- The “@caption=” if the XPath string refers to the caption.
Note: Classic Agent removes ellipses (…) and ampersands (&) from captions. Open Agent removes ampersands, but not ellipses.
Example:
Classic Agent |
Open Agent |
CheckBox CaseSensitive Tag “Case sensitive” |
CheckBox CaseSensitive locator “//CheckBox[@caption=’Case sensitive’] |
CheckBox CaseSensitive locator “Case sensitive” |
Prior text |
|
Classic Agent tag “^Find What:” |
Open Agent locator “//<class name>[@priorlabel=’Find What:’]” |
Note: Only available for Windows API-based and Java Swing applications. For other technology domains, use the Locator Spy to find an alternative locator.
Index |
|
Classic Agent tag “#1” |
Open Agent Record window locators for the test application. The Classic Agent creates index values based on the position of controls, while the Open Agent uses the controls in the order provided by the operating system. As a result, you must record window locators to identify the current index value for controls in the test application. |
Window ID |
|
Classic Agent tag “$1041” |
Open Agent locator “//<class name>[@windowid=’1041’]” |
Location |
|
Classic Agent tag “@(57,75)” |
Open Agent locator “//<class name>[@windowid=’1041’]” |
Multitag |
|
Classic Agent multitag “Case sensitive” “$1011” |
Open Agent locator “//CheckBox[@caption=’Case sensitive’ or @windowid=’1011’]” |
Only the Open Agent supports testing Java SWT/RCP-based applications.
Overview of the Methods Supported by the SilkTest Classic Agents
The winclass.inc file includes information about which methods are supported for each SilkTest Classic Agent.
Certain functions and methods run on the Classic Agent only. When these are recorded and replayed, they default to the Classic Agent automatically. You can use these in an environment that uses the Open Agent. SilkTest Classic automatically uses the appropriate Agent. The functions and methods include:
- C data types for use in calling functions in DLLs.
- ClipboardClass methods.
- CursorClass methods.
- Certain SYS functions
The Classic Agent supports all SYS functions. The Open Agent supports all SYS functions with the exception of SYS_GetMemoryInfo.