About the warning
The Name Mapping project item allows you to define names for your tested application’s objects that will be used to refer to these objects in tests. When you add an object to the Name Mapping repository and define a custom name for it, you specify criteria that will be used to uniquely identify this object in the application.
In addition to a combination of identification properties and values, there are other settings that allow you to configure mapping more flexibly. One of these settings is the Extended Find attribute, which instructs TestComplete to search for the object not only on one specific level of the application’s object hierarchy, but also on all nested levels. This attribute is useful when the application’s object hierarchy is dynamic. However, it may also cause ambiguous object identification if there are several objects in your tested application that match the mapping settings.
If a mapped object cannot be found during the test run and one of the object’s parent objects has the Extended Find attribute enabled, it might mean that the parent object was selected incorrectly due to ambiguous identification. To inform you about this possible cause of the problem, TestComplete posts a warning message to the test log. The problem description includes the mapped name for which the Extended Find attribute is enabled, as well as the full unmapped name of the tested application’s object that matches the mapping settings. You can then check whether the found object is the right one, or change the mapping settings otherwise.
Identifying the object that caused the warning
There are several ways in which you can find the object that causes the warning. Some possible approaches are as follows:
-
Locate the object in the Object Browser by its full name
The problem description displayed in the Details panel of the test log includes the full name of the tested application’s object that matched the mapping settings. If your tested application is running at the moment, you can explore its object hierarchy in the Object Browser to find this object and see if it is the right one.
-
Select the warning in the test log and then select the Details panel.
-
Write down the full object name that is included in the problem description. For example, you could copy and paste it to Notepad.
-
Switch to the Object Browser.
-
In the object tree, locate the tested application’s process and expand its object hierarchy until you find the mentioned object.
-
Right-click the object and select Highlight on Screen. TestComplete will indicate this object in the tested application with a flashing red frame.
If the tested application does not contain the problematic object, try the approaches described below.
-
-
Locate the object while running the test in debug mode
It is a good idea to run your test in debug mode and pause it at a breakpoint before the problematic operation. This is an easy way to bring your tested application to the state at which the warning occurs and diagnose the object identification problems.
First of all, you need to find the object in the Name Mapping editor:
-
Select the warning in the test log and then select the Details panel.
-
Click the link with the mapped object name. TestComplete will open the Name Mapping editor and select the specified mapped object.
Now you can run the test in debug mode and pause it to examine the tested application:
-
Double-click the warning in the test log. TestComplete will open the test and highlight the operation that triggered the warning.
-
Set a breakpoint on this line. To do this, click the editor’s gutter next to the line, or press F9. (The shortcut can be changed in the Customize Keyboard dialog.)
-
Make sure that the Enable Debugging button on the Test Engine toolbar is pressed.
-
Run the test. TestComplete will automatically pause the test execution when it reaches the breakpoint.
-
Switch to the Name Mapping editor, right-click the problematic object and select Show in Object Browser from the context menu. TestComplete will open the Object Browser and select the object that matches the mapping criteria.
-
Right-click this object in the Object Browser and select Highlight on Screen. TestComplete will indicate the object in the application with a flashing red frame.
-
-
Post a screenshot of the object to the test log
Your tested application may not be running at the moment you are analyzing the test log, or it may take a long time to bring the application to the state in which the warning was triggered. In this case, you can add another operation to your test that will post a screenshot of the problematic object to the test log. You need to add this operation before the one that resulted in the warning. After you modify your test in this way, the next time you run the test and get the same warning in the log, you will be able to clearly see which object is the cause of the warning.
To add a screenshot logging operation to your test, do the following:
-
Select the warning in the test log and then select the Details panel.
-
Click the link containing the mapped object name. TestComplete will open the Name Mapping editor and select the specified mapped object.
-
Write down the object’s full mapped name that is displayed in the top right corner of the editor, or copy it to the clipboard.
-
Switch back to the test log and double-click the warning. TestComplete will open the test containing the operation that triggered the warning and highlight this operation in the test.
-
Insert a Post Screenshot operation (if your test is a keyword test) or a
Log.Picture
method call (if your test is a script) before the problematic operation. In the parameter that specifies the object whose screenshot should be taken, use the object’s full mapped name. For more information about configuring screenshot logging operations, see Posting Images to the Log. -
Save and run the test.
-
After the test run is over, open the test log.
-
Locate and select the screenshot entry in the log and then open the Picture panel to view the image.
-
Resolving the problem
After you have identified the object that causes the warning message, your further actions depend on whether or not this is the right object:
-
If the found object is not the one you need, this means that the current mapping settings are inaccurate and do not ensure unique identification of the needed object. Most likely, the mapping settings include incorrect identification properties and values, or there are several objects in your application that match these settings. To solve the problem, review and modify the mapping settings for the problematic object in the Name Mapping editor, so that they uniquely identify this object.
-
If the found object is the needed one, you may also want to correct its mapping settings and make them more precise. This way you can eliminate the possibility of ambiguous object recognition. For example, you can add relevant identification properties, specify the required child objects and so on. Also, check if the Extended Find attribute is actually needed for the object identification, and if it is not, then disable it.
For more information on how to change various mapping settings, see the Name Mapping section.
See Also
Handling the 'Object Does Not Exist' Error
Other "Object Not Found" Errors
Name Mapping
Name Mapping - Extended Search
Object Browser Naming Notation