Forum Discussion

m_essaid's avatar
m_essaid
Valued Contributor
9 years ago
Solved

A question about manual object mapping

Hello,

 

Short question : when I map an object (in this example the notepad window), TC suggests several criteria to identify it.

As I understood, the goal is to identify properties that could make a sort of "primary key".

 

So for this object :

Sys.Process('notepad').Window('Notepad', 'Sans titre - Bloc-notes', 1)

 

TC proposes two criteria :

WndClass : "Notepad"

WndCaption : "Untitled - Note Pad"

 

Why not using simply "Sys.Process('notepad').Window('Notepad', 'Sans titre - Bloc-notes', 1)" as unique criteria ?

 

Thank you,

 

Mehdi

  • Hi Mehdi,

     

    Sys.Process('notepad').Window('Notepad', 'Sans titre - Bloc-notes', 1) is the path to the object in the object tree. Right now, you are choosing properties for only the window. So, WndClass is a unique property that will identify the control type and WndCaption will identify an object with the target caption.

     

    I don't recommend that you use Window('Notepad', 'Sans titre - Bloc-notes', 1) mostly because of the Index property. During the next run, or when several Notepad windows are run, the index may be different. Thus, TestComplete won't find the object.

     

    Anyway, you can always change the mapping properties and use the properties you want or you know the ones that will identify your control for sure.

2 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Mehdi,

     

    Sys.Process('notepad').Window('Notepad', 'Sans titre - Bloc-notes', 1) is the path to the object in the object tree. Right now, you are choosing properties for only the window. So, WndClass is a unique property that will identify the control type and WndCaption will identify an object with the target caption.

     

    I don't recommend that you use Window('Notepad', 'Sans titre - Bloc-notes', 1) mostly because of the Index property. During the next run, or when several Notepad windows are run, the index may be different. Thus, TestComplete won't find the object.

     

    Anyway, you can always change the mapping properties and use the properties you want or you know the ones that will identify your control for sure.

    • m_essaid's avatar
      m_essaid
      Valued Contributor

      Hi Tanya,

       

      Yes I already noticed the index of the process... I test in praxis only one instance of an executable.

      To be sure, I run a loop that kills every instance of the executable I want to test.

      Thank you,

       

      Mehdi