Forum Discussion

Ryu's avatar
Ryu
Contributor
7 years ago

TestComplete sees same window with different properties on different runs

Sometimes, when running a test on an application, TestComplete sees the main window as ClassName: TMainView / ObjectIdentifier: MainView (how it was originally mapped).  Other times, TC sees the same window as WndClass: TMainView (no ObjectIdentifier).  I can literally run it once, it sees the window as WndClass and my test fails; I immediately run the test again without changing anything, and it sees the window as ClassName and the test passes.  I'm really confused.  How can I get it to stop doing this?

  • OK... Now I understand.

    You have the same object mapped twice (In your project, you go to NameMapping and those two items are there).

    Basically this: Delete one of those mappings.  The Mapping is how TestComplete identifies an object.  So, it appears that, somehow, the same object has been mapped twice.

     

    My guess is that the second one (The one maped as WndClass: TMainView) is going to be the most accurate.  I'd delete the first one and see if that corrects your issue.

  • Ryu's avatar
    Ryu
    7 years ago

    I actually don't have the second one mapped; I mapped it a few times when the first one broke just to see what was happening, but then I deleted it.  Next time it happens I will try remapping everything to the second one and delete the first and see what happens.

  • Ryu's avatar
    Ryu
    Contributor

    The next time it happened, I took the time to remap everything to the second mapping (WndClass) and deleted the recording mapping (Class Name).  It has not had a problem since.  Thanks, tristaanogre!

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Is WndClass also available as TMainView in the first instance?  That is probably a better mapping option for what you're looking for, if so.

    • Ryu's avatar
      Ryu
      Contributor

      tristaanogre, I'm not entirely sure what you are asking, but it is either mapping it as ClassName TMainView or WndClass TMainView.  It's a toss up between which one it decides to see.  I have it mapped as ClassName TMainView and it does see that most of the time, but every once in a while the test fails because it can't find the window (that is when it sees it as WndClass TMainView, but I don't keep that mapping around).  In that case, restarting the test will make it see the correct mapping.  But I would like to not have to restart the test in the first place.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        If the WndClass property is available on the component ALWAYS as TMainView (regardless of mapping), edit your mapping to use that instead.

         

        I'm not sure why it keeps changing... not enough details.  However, you can make a change to your mapping to use something that consistently works.