Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

How can I test multiple local applications with SilkTest?

How can I test multiple local applications with SilkTest?

Problem:

How can I test multiple local applications with SilkTest?

Resolution:

Problem


By default, the recovery system will only work for the single application assigned to the const wMainWindow. With distributed testing, you can get recovery on multiple applications by using multitestcase() instead of testcase(). Unfortunately, multitestcase() cannot be used for local testing.

However, for multiple local applications you can use the following solution making use of the standard testcase.



Solution


To get recovery for multiple local applications, set up your frame file to do the following:


1. Get standard wMainWindow declarations for each application. The easiest way is to select File/New/Test Frame for each application, then combine the wMainWindow declarations into a single frame file. Alternatively, you may Include them with Use.

2. Make the global wMainWindow a variable of type WINDOW, rather than a constant.

3. Assign one of the windows to wMainWindow as a starting point.

4. Create a LIST OF WINDOW and assign the wMainWindow identifier for each application that you wish to test.

5. Define a TestcaseEnter function so that you reassign the wMainWindow variable and call SetAppState on each MainWin in turn.

6. Define a TestcaseExit function so that you reassign the wMainWindow variable and call SetBaseState on each MainWin in turn.

7. Use the DefaultBaseState (or your own base state) with each of your testcases. In each testcase, use SetActive each time you switch from one application to another.


The example shows how this would work in the case of two demo applications shipped with SilkTest (Text Editor and Test Application). If you wish to see the recovery system working for both applications, turn on the two debugging options in Runtime Options and look at the transcript after running the test script.


The first testcase has an intentional error in its last statement to demonstrate the recovery system. The testcase also demonstrates how to move data from one application to another with Clipboard.GetText and Clipboard.SetText. The second testcase repeats the actions of the first but without the error. In both cases, the Sleep() commands in the source code are there simply to allow time for you to read the text being entered.


Because the recovery system is on, the DefaultBaseState will take care of invoking each application if it is not already running and will return to the DefaultBaseState after each testcase, even if the testcase fails.

This sequence of events is also applicable for testing multiple applications on a single remote machine.


 Two Apps.zip



Related documents:


Old KB# 21126

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:17
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.