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.
About UI Spy
UI Spy can run as a standalone tool, or you can use it as a panel in Visual Studio:
You can use UI Spy as a standalone tool only if you have TestLeft version 2.50 or later.
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:
Note: If you use Windows 10 and cannot find UI Spy via Windows Search, try restarting Windows Explorer or rebooting your computer.
To open UI Spy in Microsoft Visual Studio, select View > TestLeft UI Spy from the Visual Studio main menu:
If the UI Spy panel is not available in your Visual Studio, make sure the TestLeft extension is installed and enabled in your Visual Studio Tools > Extensions and Updates dialog.
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.
You can use UI Spy as a standalone tool only if you have TestLeft version 2.50 or later.
Sample View
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.
Requirements
To use UI Spy, you must have TestLeft installed on your computer.
To use UI Spy as a standalone tool, you must have TestLeft version 2.50 or later.
Object Type Names
The names of object types 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 IObject
, IControl
, and others. If you select Java, UI Spy will use Java class names like TestObject
, 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:
.NET | Java |
---|---|
IControl |
Control |
IWindow |
Window |
ITopLevelWindow |
TopLevelWindow |
IWebBrowser |
WebBrowser |
There are few exceptions from this rule:
.NET | Java | Explanation |
---|---|---|
IObject |
TestObject |
If we removed the leading |
IProcess |
TestProcess |
See also Difference Between .NET and Java Versions of TestLeft.
Selecting Objects on Screen
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.
Viewing Objects and Properties
Highlighting Objects on Screen
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.
Viewing Indexed Properties
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.
Filtering Properties and Methods
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.
Refreshing the Object Tree
UI Spy does not refresh automatically when you make changes in the application. To refresh an object, click Refresh on the panel’s toolbar.
Connecting to a Remote Computer
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.
Generating Code
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.
Tips
-
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. -
To learn more about the way object identification works in TestLeft, see Understanding Object Identification. To learn more about object models, see Mapping Test Objects.
-
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.
Licensing
To switch between ID-based and key-based licenses, click and then click the license type you want to enable.
If you use the ID-based license, to log out or to switch a user, click and then click the appropriate command.
FAQ
What do object names in UI Spy mean? Are these names used in tests?
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.
My application is not showing up in the object tree.
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.
Why do some windows and controls appear in grey in the object tree?
This means that they are hidden. The object tree also uses grey for certain non-visual objects.
How do I spy on menus?
Use the Point and Fix mode.
How do I spy on objects that appear on a mouse hover or mouse click (popups, tooltips and so on)?
Use the Point and Fix mode.
“Pick Object” and “Point and Fix” do not select my object, or
the object appears in the application, but does not show up in UI Spy.
-
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:
-
List actions
-
.NET:
IComboBox.ClickItem(item)
- to click an item,IComboBox.wItem(index)
- to get the item text. -
Java:
ComboBox.clickItem(item)
- to click an item,ComboBox.getwItem(index)
- to get the item text.
-
-
Grid actions
-
.NET:
IGridView.ClickCell(row, column)
- to click a cell,IGridView.wValue(row, column)
- to get the cell value. -
Java:
GridView.clickCell(row, column)
- to click a cell,GridView.getwValue(row, column)
- to get the cell value.
-
-
My object is missing from the object tree.
-
Make sure the object exists in the application.
-
Click Refresh on the UI Spy toolbar to pick up changes.
A window (or control) screenshot is black.
Most likely, the window is minimized. To explore a control, maximize its parent window.