You use TestLeft UI Spy to browse objects in Windows and web applications running on your local computer or on a remote machine, and to generate code for your automated TestLeft tests.
UI Spy can run as a standalone tool, or you can use it as a panel in Visual Studio:
The TestLeft executable file is <TestLeft>/SmartBear.TestLeft.UI.Spy.exe.
You can find TestLeft UI Spy in the Windows All apps menu, or simply type UI Spy in the Windows Search box:
To open UI Spy in Microsoft Visual Studio, select View > TestLeft UI Spy from the Visual Studio main menu:
To open UI Spy from Intellij IDEA, select Tools > TestLeft UI Spy from the IDEA main menu:
This will start UI Spy as a standalone executable. You can also run UI Spy from the Windows All apps menu (see the Standalone tab).
If you use another Java IDE, run UI Spy as a standalone executable.
Here is a sample view of UI Spy:
As you can see, on the left, UI Spy displays the hierarchy of test objects that correspond to applications, windows and controls existing in the system. On the right, it displays the test interfaces supported by the object selected in the object tree, and the properties and methods of these interfaces.
Some objects have their native properties and methods exposed, for example, HTML/DOM properties, .NET or Java class properties. They are listed under the “Available through the IObject (or TestObject) interface” category at the bottom of the list. You can access them in your tests via special method calls.
UI Spy can display the object hierarchy on your local computer as well as on a remote machine (see below).
UI Spy can access the object hierarchy only if the test engine on your or remote computer uses the default port (2377). Otherwise, the object tree will be empty.
The type names you see in UI Spy depend on the language you selected for code generation:
If you select C# or VB.NET, UI Spy will use .NET interface names like
IControl, and others. If you select Java, UI Spy will use Java class names like
Control, and so on.
The Java class names are similar to .NET interface names. However, they do not have the leading
I character in their names, for example:
There are few exceptions from this rule:
If we removed the leading
To view an object’s properties and methods, you find that object in the object tree manually, or you can select the object from screen. TestLeft offers two selection modes: Pick Object and Point and Fix.
Tip: The Point and Fix mode is especially useful when you need to select context menu items, drop-down lists or tooltips, that is, objects that disappears when you move mouse out of them.
You can select objects from screen of your local computer. You cannot do this for remote computers.
Right-click an object in the object tree, and then click Highlight on Screen. UI Spy will activate the appropriate control or window and show a flashing red frame around it.
To view the flashing red frame on the remote computer’s screen, you need a Remote Desktop connection to it.
To view a property that takes parameters, click the property’s button and specify a parameter in the subsequent dialog. If the specified parameter is valid, UI Spy will show the property value.
The object you are exploring in UI Spy can contain many properties and methods. To simplify searching for the needed property or method in UI Spy, use Filter.
The filter applies both to member names and values.
UI Spy does not refresh automatically when you make changes in the application. To refresh an object, click Refresh on the panel’s toolbar.
If you have TestLeft/TestComplete/TestExecute installed on a remote computer, you can connect your TestLeft UI Spy to that remote computer. This way, you will be able to explore the object hierarchy and generate test code for applications running on a remote computer:
UI Spy will connect to the TestLeft/TestComplete/TestExecute RESTful service running on the remote computer and will retrieve information on the processes running there.
Both the remote computer, whose object tree you want to explore, and your local machine must meet certain requirements.
To disconnect from the remote computer, select the appropriate node in the object tree and then click Remove Host.
UI Spy includes several commands that generate code for getting test objects and calling their methods and properties:
Copy Identification - Generates code that obtains the test object and copies this code to the clipboard.
Copy Model - Generates code for the object model and copies this code to the clipboard.
Copy Member Call - Generates code for calling an object’s method or property. Works for any method or property, including the native ones.
After you generated code, insert it to the needed place in your test. Tweak the code if needed.
The generated code can be large due to intermediate objects. Review the code and delete intermediate objects that do not have unique identification properties, such as nested web Panels without IDs. Remember to add or increase the search depth in each
Find call that precedes the deleted portion of the generated code.
UI Spy includes settings for configuring the generated code. You can select a language, choose the start point for the object identification code (
Driver, process, browser, and so on), and set how TestLeft will split the generated code into lines.
UI Spy shows object names based on the object type and some identification properties. These names are for display purposes only, you do not actually use them in your TestLeft tests. Tests address objects by using search patterns that specify unique properties and values of the sought-for objects.
However, some error messages in TestLeft logs may include technical information with object names in the UI Spy format, so you can find these objects in UI Spy.
This is likely because your application is running with elevated permissions (as an Administrator) or under another user account. Run UI Spy as an Administrator to see all the applications in TestLeft UI Spy. If you use UI Spy integrated in Visual Studio, re-run Visual Studio as an Administrator.
This can also happen if the application was started after you opened UI Spy. If so, refresh UI Spy: Right-click <Local system> and select Refresh Children.
This means that they are hidden. The object tree also uses grey for certain non-visual objects.
Use the Point and Fix mode.
Use the Point and Fix mode.
Most likely, your application or web browser was not prepared for testing.
Most applications and browsers are ready for testing as they are. For others, you may need to perform certain actions like enabling some browser settings or compiling your application in a specific way. See Configuring Applications and System for details.
Note that there are some limitations with technology support.
The object may be unspyable, because it is not a separate logical object. For example, text drawn on a canvas.
Items of a compound object, such as list items, grid cells or toolbar buttons, may be unspyable, but you can automate them by using relevant methods and properties of the parent object. For example:
IComboBox.ClickItem(item) - to click an item,
IComboBox.wItem(index) - to get the item text.
ComboBox.clickItem(item) - to click an item,
ComboBox.getwItem(index) - to get the item text.
IGridView.ClickCell(row, column) - to click a cell,
IGridView.wValue(row, column) - to get the cell value.
GridView.clickCell(row, column) - to click a cell,
GridView.getwValue(row, column) - to get the cell value.
Make sure the object exists in the application.
Click Refresh on the UI Spy toolbar to pick up changes.
Most likely, the window is minimized. To explore a control, maximize its parent window.