Forum Discussion

DKumar04's avatar
DKumar04
Contributor
6 years ago

how to write short name for the object without using 'name mapping' in test complete?

Currently we are making use of 'Full Name' to develop automation test scripts. The name is too long. We want them to use short. We do not want to rely on Namemapping. Please help us with example

 

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Short answer... there is no way.  The "Full Name" is the full hierarchal tree of the parent/child relationships of the object.  Your best bet is to use variables to short it down but that just creates the burden of having to assign a variable every time you want to "rename" the object.

    Your BEST answer (and I really don't understand why people are so reluctant to use NameMapping) is to use NameMapping and utilize the Alias feature to shorten the name.

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi DKumar04 ,

     

    Using variables is the only way for this, as Robert said.

    The pseudocode will look like this:

    //JScript
    
    var process = Sys.Process(your tested app)
    var mainWindow = process.Window.Window
    var leftPanel = mainWindow.Object.Object.Panel
    var button = leftPanel.Object.Button

    Could you please clarify what your use case? Perhaps, we can suggest something else.