Forum Discussion

jsc's avatar
jsc
Regular Contributor
12 years ago

Web tests without name mapping / identifying objects through unique ids?

Hi all,



I am currently starting the automated test of a browser-based application.

In a discussion with one of the developers about mapping objects (every object gets its own application-wide hard-coded id), we thought about adapting the test to possible changes in the structure of the application.



for example some panel is mapped like this:

Aliases.browser.pageHttpXYZ.panel2.panel.panel.panel1.panel.panel.panel.panel1.

panel.panel2.table.cell2.panelSettingsRepositoryExcelSele



currently if for example there will be an extra panel in one of the top levels or one of the top level panels will be removed the whole test will fail and has got to be updated manually.



Is there any possiblity to avoid such problems by mapping objects not through the structure (and therefore not through the name mapping) but through an unique identifier and not using name mappings?



As I am at the start of the automation, I try to choose the best solutions that is as much flexible on changes and does not create to much overhead maintaining the test.



I am open to any help

- web pages related to this

- own experiences and good / bad solutions (that have to be avoided)



Thanks a lot.



Joachim
  • jsc's avatar
    jsc
    Regular Contributor
    my first (straight forward) idea is:

    - rebuilding / updating the namemapping after each change of the displayed screen

    - clicking on objects that are solely mapped through the unique id and do not contain any information where in the structure the object can be found



    is such stuff possible?

    what are the drawbacks? (maybe performance on rebuilding the namemapping?)
  • jsc's avatar
    jsc
    Regular Contributor
    thanks!

    The extended find looks quite interessting.



    For the first shot I enabled "Find this node on any level of NameMapping tree". I did not recognize this checkbox before, that will do it in most cases.



    Best regards

    Joachim

  • There are some alternatives using DOM methods that your devs should recognise and be able to advise on:

     

    These are all exposed to TC as members of the Page object:



    .zDocument.querySelector()

    querySelector



    .zDocument.querySelectorAll()

    querySelectorAll



    .EvaluateXPath()

    XPath