SilkTest’s replacement for the Exists() method

I’ve recently started a new SilkTest project testing a web application, using SilkTest’s new open agent and the 4Test scripting language. This post covers an aspect of what I’ve learned.
In the SilkTest ‘classic’ agent, you used the ‘Exists()’ method to test whether an object exists in the application under test, e.g.,:

if (Page.Object1.Object2.Object3.Exists())
// do something...

With the open agent’s dynamic object recognition, the Find() method is what you need to use, but it took me some research to figure out how to do an if statement with the find() method. Here’s a test:

if (Desktop.Find("//BrowserApplication//BrowserWindow//INPUT[@id='sysname']",{5, false}) != NULL)
// do something

You’ll notice that I added an optional argument: {5,null}. These two values constitute a FINDOPTIONS data type record. The first one is the timeout. The second value is the important one for our purposes: it “determines whether the Find method throws an E_WINDOW_NOT_FOUND exception if no object is found or NULL is returned if no object is found. ”
So, you set that value to FALSE and then test to see whether or not the Find() method returns NULL. If not null, the object exists.

Borland SilkTest’s new open agent

I’ve been a user of Borland SilkTest off and on since the late 1990s. After not having used it for several years, I picked it up again when I worked at Borland 2006-2009. Since it was our company’s own tool, we intended to use it to automate testing of the web UI application I was working on. However, we faced some significant challenges.
The first problem was the well-known problem with window declarations. Due to the depth of objects in our web-based UI, maintenance of the window declarations was an onerous task. The other problem was that the agent and recorder simply didn’t interact very well with our AJAX-y UI (we were using ExtJS for the UI).
Since that time, Borland has released the new ‘open agent’ for SilkTest. I began using the open agent right before I left Borland and I’m creating a new project with it here at Polycom. I’m happy to say that the SilkTest dev team has done a really good job of overcoming the previous shortcomings of the ‘classic’ agent.
The biggest problem I’m facing now with my SilkTest open agent automation is access to information. The user documentation for the open agent is not as mature as the documentation for the open agent, and as a result, I’ve opened numerous support tickets with Micro Focus to figure out how to do things.
I figured I should use my blog to share some of the things I’ve learned about the open agent and its 4Test implementation. Stay tuned…