I have an app I am testing that runs on multiple environments. I need to be able to change part of a URL so it can determine which server the app is running from. For example one run on http://laxhns290:7001/.... and the other http://plmedu/... If I just make this first part a wild card the test slows to a crawl because it is forced to use Smart ID. I was wondering if there is a way to use a parameter for this part of the URL and keep the rest of the URL as it was. I have tried using a regular expression but have had no luck. If anyone has an idea please let me know.
Re: Use parameter in Object Repository as part of URL
Smart Identification should only kick in when QTP is unable to identify the object it is looking for. If you identify your object correctly in the OR, QTP won't need to use Smart ID at all.
So the trick is finding the right way to identify the URL.
A regular expression might work, but you need the right one. Is there a part at the end that is constant for all your URL possibilites? Maybe something like "http://.*/\.com" might work.
Another way that might work with a regular expression, assuming your two URLs are "http://laxhns290:7001/something.com" and "http://plmedu/something.com", you could write the regexp as "http://(laxhns290:7001|plmedu)/something\.com" - if you have more than two possibilites, you can add the rest inside the ( ) by just separating each one with a pipe symbol.
Another choice is to edit the URL description in the OR to use a parameter. You just need to decide where your parameter is defined (datatable or environment variable) then create that parameter, then edit your OR to assign the parameter to your URL description.
Neither one of those options eliminate the use of smart ID. The parameter option I think is the best but is there a way to call a parameter in a regular expression? I would need something like http://<parameter>/this/that.jsp.