Forum Discussion

gordon_frontier's avatar
Occasional Visitor
2 months ago

Scripting Name Mapping Definitions

I note that Name Mapping for each project sits in a couple of XML files, but they are not intended for direct editing.

The information in a Name Mapping definition is fairly straightforward.  It seems it would be very handy to have a utility to generate Name Mapping for a project from something like YML or JSON.

Does such a utility exist?

3 Replies

  • rraghvani's avatar
    Champion Level 3

    You have a Name Mapping editor in TestComplete. What would be the benefit of an editor/utility for generating YML or JSON?

    • detached31's avatar
      Occasional Contributor

      If you already have a computer-readable definition of your UI (e.g. XAML), you could generate a default NameMapping, which would save time instead of using TestComplete UI.

      I guess the "reading JSON", "writing XML" is easy; the added value is in exploiting the definition of the UI, which could be heavily dependent on the way (framework, templates...) with which your application is written.

      • Matthias68's avatar
        Occasional Contributor

        We created a Utility script which we can use to automatically create the name mapping of our dialogs. To use the script, only the window needs to be created manually in NameMapping as a starting point. Our script then recursively reads out the children of the relevant elements and inserts them into the name mapping using AddNamedChild. Elements that are relevant to us are given a special prefix. We then save the whole thing. In a second step, the XML file is actually processed directly and the corresponding aliases are created for the elements with a prefix. It would of course be nicer if you didn't have to edit the XML file directly, but instead had appropriate commands for this.

        We created a feature request for this:

        Extended Scripting Support for Name Mapping | SmartBear Community

        In my opinion, this topic here would be another use case for our feature request.

        But I also agree with the previous commentator that the logic behind selecting the right GUI elements for name mapping and aliases is actually where the most work and value is.