Forum Discussion

wsherwin's avatar
wsherwin
Occasional Contributor
11 years ago

Field Dichotomy: Found by One Script; Unusable by Other Script

Testing a screen that takes user input, I have a field that I'll call objName that is called by two different scripts.  It worked in the first script for a long time but, when it stopped working, I recorded another script to test the same field.  TestComplete assigned it the same name ("objName"), and I am able to re-run this script.



However, when I try to run the first script, into which I copied the object from the second script, the first script still cannot find objName, even with a blinking cursor in it, and even though I can type text into it while the script is waiting and failing.  Advice appreciated...

6 Replies

  • Are you using NameMapping? If you are, then you should compare mapped object properties in the old and new tests.
  • wsherwin's avatar
    wsherwin
    Occasional Contributor
    NameMapping is being used, but I'm not doing anything explicitly to create entries within it.  All I know is that controls, etc., that used to work now fail with no changes to scripts - or anything else for that matter.
  • NameMapping contains information needed to find the tested object: its position in the application objects tree and properties that uniquely identify the object among its siblings. It seems that something have been changed in the tested application that is why existing NameMapping information is not valid anymore. When you recorded new script TestComplete automatically collected new NameMapping information. Even if the script is the same, the NameMapping information is different and you need to find and fix this difference.
  • wsherwin's avatar
    wsherwin
    Occasional Contributor
    So, tell me if this makes sense: I recorded a script, Test3, that is identical in every way to Test2.  When I first ran Test2, it worked; then, it stopped working.  When I first recorded Test3 and ran Test3, it worked; after I ran Test2, not only did Test3 fail, but Test2 started failing, too.  Again, there is no difference at all between the two scripts.
  • You can try to update NameMapping as it described here: http://support.smartbear.com/viewarticle/55793/.

    Also maybe after the first run of your script something changes in your application so the object cannot be found anymore, so maybe you need to restore the initial state of your application before running the test.
  • wsherwin's avatar
    wsherwin
    Occasional Contributor
    I restart the Application for each test, so I don't think that Application state comes into play...  I'll look at updating name mapping, but this remains confounding.