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

Are there any examples of how SilkTest can use functions within tags?

Are there any examples of how SilkTest can use functions within tags?

An example is in the ShowBorderlessTables Browser option when using the DOM extension. Normally, if a particular table cannot be recognised, the Browser option (0 to 1.0) can be adjusted until the table is recognised.

Consider a test script that needs to access an object in a table (when ShowBorderlessTables is at 1.0) and then readjust the SetBorderlessTables option back to 0.5 in order to continue the test script.

Example:

Browser.SetUserOption ("ShowBorderlessTables", 1.0, USEROPT_DEFAULT)
Print (HomePage.MyTable.Exists ())
// NOTE : 0.5 is the default
Browser.SetUserOption ("ShowBorderlessTables", .5, USEROPT_DEFAULT)
Print (HomePage.Exists ())

The problem is that the script is not as legible with SetUserOption occurring in multiple places. Also, it would be difficult to remember that this adjustment needed to occur when writing the script.

By using tags with embedded functions, a resolution may resemble the example below ;

Using this technique, a tester would be able to adjust the ShowBorderlessTables value at run time. Now each HtmlTable2 object has the ability to describe its own BORDER setting.

Using this technique, the script would look like :

Print (HomePage.MyTable.Exists ())
Print (HomePage.Exists ())

Notice that the ShowBorderlessTables settings have been removed.

To verify that this worked :

Print (Browser.GetUserOption ("ShowBorderlessTables", USEROPT_DEFAULT)) // prints 0.5
Print (HomePage.MyTable.Exists ()) // prints TRUE
Print (Browser.GetUserOption ("ShowBorderlessTables", USEROPT_DEFAULT)) // prints 1.0
Print (HomePage.Exists ()) // prints TRUE
Print (Browser.GetUserOption ("ShowBorderlessTables", USEROPT_DEFAULT)) // prints 0.5

Remember that the idea is to determine the tag so that the application can be referenced. The idea is NOT to reference the application so that a tag can be determined. In other words, a tester will not be able to reference anything about another object in the tag function. Only that which is internal to the automation architecture and outside the application may be referenced.

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:23
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.