Handling the 'The alias refers to a mapped object that is not in the NameMapping project item.' Error

Applies to TestComplete 15.61, last modified on February 27, 2024

About the error message

The test engine logs this error when it is unable to find the name mapping item that corresponds to the alias whose method or property the test tried to access.

The TestComplete NameMapping subsystem uses two trees: Mapped Objects and Aliases (see Name Mapping). The Mapped Object tree corresponds to the object hierarchy in the application under test. Aliases represent the logical hierarchy. You can change the object hierarchy in it at your desire. For example, you can hide some container objects to make your test object names shorter:


Note: the NameMapping object provides a scripting interface to Mapped Object tree items.

Aliases link to the appropriate Mapped Object items that, in their turn, link to the tested application’s objects. When you are accessing an alias in the test, the test engine gets recognition criteria from the appropriate Mapped Object item and then finds the needed object in the system.

The Aliases tree may contain items that do not match any item in the Mapped Object tree. This happens if you remove items from the Mapped Object tree but keep the Aliases tree unchanged.

When you attempt to call a method or property of such an alias, an error occurs, and the test engine posts the “The mapped item was not found...” message to the test log.

Diagnosing the problem

  1. Open the test log and find the “The object does not exist” message in it.

  2. (Optional). To view the test commands that posted the error message, double-click that message in the test log. TestComplete will open the test containing the problematic command and highlight that command in the test.

  3. After you selected the error message in the log, examine the description that is shown in the Details panel for the message. The description contains the alias of the missed object.

    Double-click the alias to open the Name Mapping editor and highlight the alias in it. The editor will “tell” you that the alias is empty.

Solving the problem

If you got this error, this means that your test works with an object that has been removed from the application. To fix the problem, you have to change your test. The exact steps to follow depend on the actions your test performs. For instance, if you click the missing object to activate a form or focus some controls, try simulating a click on some other controls. If you use methods and properties of the missing object to enumerate its child objects, try doing this by some other means (for instance, by calling methods and properties of their new parent object).

See Also

Other "Object Not Found" Errors
Name Mapping
Name Mapping

Highlight search results