Forum Discussion

g_cause's avatar
g_cause
New Contributor
10 years ago

Object not found errors - Non-standard URL's and TestComplete

The web application we are testing has not followed internet URL conventions and instead of using Query Parameters they are embedding their VersionNo, SessionId and Username in their URL i.e.

 

Aliases["browser"]["pageAppcontract70153GrantCause7"]["formForm1"]["tableContractexplorercontentPnlm"]["table"]["cellContractexplorercontentPnlma"]["textnodeNew"]

 

The SessionId is dynamic so the subsequent run shows:

 

Aliases["browser"]["pageAppcontract70153GrantCause8"]["formForm1"]["tableContractexplorercontentPnlm"]["table"]["cellContractexplorercontentPnlma"]["textnodeNew"]

 

As a result the test then fails saying Object not found.

 

Also if they change the version number on the next patch release it will fall over i.e.

 

Aliases["browser"]["pageAppcontract70154GrantCause8"]["formForm1"]["tableContractexplorercontentPnlm"]["table"]["cellContractexplorercontentPnlma"]["textnodeNew"]

 

We need a way of ignoring this via a wildcard or some other mechanism i.e.

 

Aliases["browser"]["pageAppcontract*"]["formForm1"]["tableContractexplorercontentPnlm"]["table"]["cellContractexplorercontentPnlma"]["textnodeNew"]

 

Any suggestions on how we get around this?

 

7 Replies

  • You can use a global variable to store part/all of the URL and use that in your object description. The global variable can also contain wildcards is you need it to.



    I use this all the time so I can easily switch environments ...
  • ArtemS's avatar
    ArtemS
    SmartBear Alumni (Retired)
    Hello Grant

    Certainly, you can use wildcards to specify variable parts in URL.



    You'll need to modify the default name mapping criteria applied to the web page element. Namely, change the URL criteria from pageAppcontract70153GrantCause7 (or whatever URL is there) to pageAppcontract?????GrantCause* or even to pageAppcontract*



    See Using Wildcards in Name Mapping.
  • g_cause's avatar
    g_cause
    New Contributor
    Thanks for the reply Artem.



    This appears to work at the individiual test step level but can we do this at a project level to avoid all the rework involved in complex tests?



    The TestComplete help website talks about ignoring query string parameters but given they arent using any in this case is there any other project level option for ignoring URL component parts using wildcards?
  • g_cause's avatar
    g_cause
    New Contributor
    Further to this the only way we can get the mapping working is to let the test run, let it fall over, select the mapping name from the error message in the bottom window, this opens the name mapping screen. We add the wildcard to the URL and then re-run the test. Eventually we get to the end of the test and everything is mapped. That was the rework I was referring to in my previous post.



    If we could do this at the project level that would save considerable time. For now we are just glad we are able to work around the non-standard URL formats.
  • ArtemS's avatar
    ArtemS
    SmartBear Alumni (Retired)
    Hello, Grant

    Name mapping works on a project level, hence it should be effective for all tests in a project.

    Try mapping the "problematic" pageAppcontract object manually, prior to recording any tests (as described in Mapping Objects Manually). For the URL property specify a value using a wildcard - pageAppcontract*

    Later on, TestComplete will use the mapped page object in all recorded test (as long as properties of a recorded page will match the URL and other mapping criteria)



    If the elements of your page also depend on dynamic identifiers, then read Handling Dynamic Identifiers to learn how to work with such elements.
  • g_cause's avatar
    g_cause
    New Contributor
    Ok the main issue we have is we are getting weekly patch updates and the version number is changing in the URL.



    So the Name Mapping folder in the project had thousands of entries with each dynamic URL name being mapped automatically by TestComplete.



    This included multiple versions of the same URL's as the version number portion of the URL changed i.e. 153, 154, 155, 156.



    I have cleared the entire folder out and rerun the tests and as I get an error I have remapped a few of the tests and then gone into the Name Mapping folder and updated the URL entries for these mappings to use wildcards in the URL property.



    None of the other properties are changed when remapping so FullName, Name and ObjectIdentifier and WndClass etc still has the version number in the URL in it ie. 156.



    Do I need to change these other properties to use wildcards or is changing the URL property enough to remap it?



    Now I have only a handful of Name Mapping folder entries.



    Now as I rerun the tests and get an error it remaps it to these modified versions as the new mappings are being pointed to the single wildcard entries for these URL's.



    I wont know if this has worked until I get the next patch.
  • ArtemS's avatar
    ArtemS
    SmartBear Alumni (Retired)
    >>Do I need to change these other properties to use wildcards or is changing the URL >>property enough to remap it?



    If the FullName, Name, ObjectIdentifier, WndClass and other properties that contain URL are used to identify mapped objects (that is when they and their values are listed in the Properties pane of Name Mapping Editor), then yes, you need to replace the version number portion with a wildcard.