Forum Discussion

falcron's avatar
falcron
Occasional Contributor
14 years ago

Web test fails randomly

I am getting random "The item was not found" errors when testing my web app.  My test run will randomly fail at different locations in my test but always when trying to click this button.  However, the issue is not with wildcards in my namemapping (those are all covered).  The issue is how TestComplete is seeing the object.  What could cause this?  Would it *have* to be that a different page is being received?  How can I go about telling this manually?



The object as recorded is:



Aliases.firefox.pageBackupOnlineRemoteDataBackup4.panelContainer.panelContent.panelBgComputers.panelProfileRow7267534.panelSettingsRowSmall.linkViewLog



Sometimes, it will fail to click this link, thus failing the test... and when I inspect it afterward, it will inspect one of three seemingly random ways which explains why it was not found, but I don't get why this would happen randomly.  My web devs have assured me that the page itself is not different.



The three ways it identifies after failure are as follows (Note the first one where the 4 changes to 6):



Aliases.firefox.pageBackupOnlineRemoteDataBackup6.panelContainer.panelContent.panelBgComputers.panelProfileRow7267534.panelSettingsRowSmall.linkViewLog



Aliases.firefox.pageBackupOnlineRemoteDataBackup4.panelContainer.panelProfileRow1206321.panelSettingsRowSmall.linkViewLog



Aliases.firefox.pageBackupOnlineRemoteDataBackup4.panelContainer.Panel("Profile_row_12057_30").Panel(0).Link(0)


7 Replies


  • Hi Vince,





    You need to examine your Name Mapping scheme - specifically, the recognition criteria of the Aliases.firefox.pageBackupOnlineRemoteDataBackup6 and Aliases.firefox.pageBackupOnlineRemoteDataBackup4 objects. It looks like the criteria are ambiguous and therefore TestComplete recognizes the same page as different objects in different test runs. Also, if the two objects are actually supposed to refer to the same object, you should probably remove unnecessary mappings and make only a single page object be used to avoid further problems with your Name Mapping scheme.


  • falcron's avatar
    falcron
    Occasional Contributor
    Not sure what you mean -- the 4 and 6 pages are the same, but some items on the page are being shown as 6, and some are 4, but sometimes it scrambles -- one that was IDed as 4 is now IDed as 6 (But ones that were originally IDed as 6 are never IDed as 4).  I'm not sure how I can go about deleting/fixing my namemapping file in a way to make it completely identifiable.



    I'm also a bit concerned why there is such a difference between this one object getting identified differently in my test runs.  It would make sense if we're getting served different pages every once in awhile, but our devs say all the pages should be identical.  It seems clear that isn't the case, but I'm not sure - they aren't familiar with TestComplete, so their answer will more than likely be "Your automation isn't identifying it properly" which I'm pretty sure isn't the case.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    It's not that TestComplete is not recognizing it correctly but more on the lines that the NameMapping that was either recorded or manually added for TestComplete is ambiguous in determining the difference.



    As was pointed out, you need to edit the NameMapping for those two objects, eliminating one of the two and updating the remaining one to be less ambiguous in it's ability to recognize the component.  That will then get rid of TestComplete's confusion and make your test a lot more reliable.



    You may not be getting precisely this error, but this appears to be the root cause, that somehow the same component got mapped twice.  This needs to be corrected.  Check out http://smartbear.com/support/viewarticle/18855/ for some tips and tricks to resolve this.
  • falcron's avatar
    falcron
    Occasional Contributor
    Gottcha.  So I have to edit the naming/details of that object in the name mapping.  I guess it doesn't help that we have a ton of dymanically generated stuff (ids, etc) on the test.  I had wildcarded a lot of that stuff which fixed 99% of my issues, its just this one page.



    I'll give it a run and see what happens.



    This will be so much better when I hone my scripting skills and can do it through scripts than using recording feature.  :)



    Thanks guys!
  • vex's avatar
    vex
    Contributor
    Ok so.. need some extra help here.  I figured out what went wrong, and I actually decided to re-start my automation building from scratch (afterall, the first go was mainly just learning the tool) with manually entering keywords instead of recording -- I am testing a web app with a huge number of dynamic elements, and it was reaking havoc on my namemapping file when just using the record feature.



    With that said, how *would* I go about changing a situation like this in a namemap (my old project was like this)



    Aliases.firefox.panelCon.cell1.Item1 -- this has 4 things underneath it.

    Aliases.firefox.panelCon1.cell1.Item1 -- this has 5 things underneath it.

    Aliases.firefox.panelCon2.cell1.Item1 -- this has 27 things underneath it.



    I discovered a sneaky dynamic element that was used to identify the panelCon object.  Now, I can fix that, but how exactly would I "move" the elements from panelCon1 and 2 to panelCon and fix my keyword tests in the process?  Is that as long of a process as I think it is, or is there some sort of shortcut?



    My new tests are running flawlessly, but just wondering how to do this for the future in case I get faced with this situation again.



    Thanks!



  • Hi Vince,





    You can simply drag-and-drop nodes in the Mapped Objects tree from one parent to another. After that, you'll be able to remove unneeded parent nodes.


  • vex's avatar
    vex
    Contributor
    Weird, I could have sworn I tried that.  Well that makes it easier :)