4

I'm automating(using record) a functional scenario using TestComplete. The NameMapping future is automatically adding elements to repository and when I run the script in other browser the tool is unable to find few elements. When I searched for root cause i found that NameMapping future is giving different names for parent objects of particular element and for some elements the hierarchy is getting changed from browser to browser. How this could be possible? How can we avoid this to do cross-browser testing?

For example, in the demo site "http://secure.smartbearsoftware.com/samples/TestComplete11/WebOrders/Login.aspx" the tool gave following aliases for a same object: ZIP field in "Edit Orders" page.

IE 11:

Aliases.browser.pageWebOrders.formAspnetform.tableFmworder.cell.textboxTextbox5

Chrome:

Aliases.browser.pageSecureSmartbearsoftwareComSa2.formAspnetform.textboxTextbox5
4

Using record-replay automated testing tool has its ups and downs, and the problem you are having is one of those downs you will have to deal with all the time.

There is only one way to completely avoid this problem,

  • Using Xpath, Css selector to address an element instead of using record-replay function provided by test complete.

You may ask:

  • What is the purpose of using test complete (or any other record-replay tool) if we need to write scripts? As the purpose of using a record-replay tool is to avoid scripting.

In reality:

  • Scripting is not conflicting with using a record-replay tool, every now and then, we need to write scripts to accomplish record-replay tools can not do, for example, select a random element from a list.
  • And very commonly we need to use scripts to avoid the problem you are having.

Test complete supports python and javascript scripting, it may take some effort to learn them but effort will be well spent.

  • Yes, I prefer scripting using JavaScript and I already created scripts by using find methods, querySelector and findChildByXpath methods. But our client is asking us to use Name Mapping, which is causing above mentioned issue. So is finding elements/objects using scripting better(faster and reliable in maintenance) than Name Mapping feature? – Surya T Jan 4 '17 at 14:31
  • @VinayT, in my personal opinion, yes. Your client is not always right, they do not know what they want. In the future, when tests fall apart, they will come back and blame you about it. – Yu Zhang Jan 4 '17 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.