Posts: 24
Threads: 7
Joined: Mar 2011
Reputation:
0
03-23-2011, 08:36 PM
Hi,
I am new with QTP and self learning this tool.
I have a question on how to setup dynamic address (URL) for the Same Test which has reusable actions, when they run? Since the Web Application is the same and behaves in a similar manner except the address, we plan to use the same dataset through datatable for each corresponding test.
Please advise a simple and easy to implement solution.
Thanks in advance for the help.
Subha
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
03-24-2011, 11:22 AM
Use a tabular approach,
In one column have all the url's and then read through each cell containing the url and pass it to the test/action.
I may be wrong, probably because i may have not interpreted your question correctly. Would you please write up more detailed explanation which would help me to decode faster ?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
03-25-2011, 09:08 AM
Two things you may want to do,
1. Excel data input
2. Regular expression.
First build your data input as such that there are 2 columns,
1. Url
2. Condition - Dev, QA, QA1 etc etc
Check the browser properties, and the page properties, regular expression it such that it can be identified for all of the environments.
On your script, loop through the excel and based on the CASE condition you need, if you want to run for QA then use the url defined for QA.
Makes sense?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Posts: 24
Threads: 7
Joined: Mar 2011
Reputation:
0
03-29-2011, 06:27 PM
Thanks Basanth, I will give a try.
Can you also let me know how I can set and use the Environment variables - BROWSER_ENV and URL_ENV?
Thanks,
- Subha
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
03-29-2011, 09:06 PM
Since these are user defined variables,
Test settings -> environment variables -> user defined
create both the variables BROWSER_ENV and URL_ENV with blank values.
On your script to assign a value to the variable,
Environment.Value("BROWSER_ENV") = "varvAlue"
To retrieve the value it holds,
Msgbox Environment.Value("BROWSER_ENV")
This should return varvAlue.
Helps?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
03-31-2011, 08:51 PM
Yes. Use,
SystemUtil.Run "Iexplore.exe", "www.google.com"
Or
Learn about InvokeApplication.
The one you have suggested is to be used purely if it is done only through vbscript. If you are doing through QTP then the ones i suggested are generally used.
PS : Although answered, i am going to close this thread as it has deviated largely from the original intent of the question. Suba, Please open a new thread with the same question if you are not satisfied with the answer.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
04-01-2011, 08:21 AM
Thread closed.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.