Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running Shared Test in Multiple Address
#1
Solved: 11 Years, 4 Months ago
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
#2
Solved: 11 Years, 4 Months ago
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.
#3
Solved: 11 Years, 4 Months ago
Basanth,

I think you have intepreting it correctly. I am including a small example of a "login" Action and initial portion of some other Action (Say "ClientSearch"). I would like to access the similar application with dynamic URL which represents different environment (like Dev1, Dev2, QA1, QA2 and so on).

For example:
Some "x" address is used to launch the application staring with the login and going into other Action in sequence.

How can I dynamically substitute with a different address "y" if I want to run the same test in a different environment?

Will the dynamic substitution od address will dynamically take care the Browser and Page info as highligted below?

Thanks in advance.
Subha

Login Action:
Code:
Browser("[b]ent_b_6_0_markdevlan_ent_b_6_0[/b]").Page("[b]ent_b_6_0_markdevlan_ent_b_6_0[/b]").WebEdit("LoginUsername").Set "Someone"
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").WebEdit("LoginPassword").SetSecure "Something"
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").WebElement("Login").Click
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").Image("Minimize / Maximize").Click
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").WebElement("Help Module").Click
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").WebElement("WebElement").Click

ClientSearch Action:
Code:
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").WebElement("Clients & Policies").Click
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").WebRadioGroup("searchtype").Select "#0"
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").WebEdit("companyname_2").Click
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").WebEdit("companyname_2").Set DataTable("p_CoName", dtLocalSheet)
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").Link("Search").Click
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").Link("30000927").Click
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").WebElement("30000924: SB Test8 Corp.").Click
Browser("ent_b_6_0_markdevlan_ent_b_6_0").Page("ent_b_6_0_markdevlan_ent_b_6_0").WebElement("Policies & Quotes (0)").Click
#4
Solved: 11 Years, 4 Months ago
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.
#5
Solved: 11 Years, 4 Months ago
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
#6
Solved: 11 Years, 4 Months ago
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.
#7
Solved: 11 Years, 4 Months ago
Thanks Basanth. Will try to use as you suggested.

In the meantime I have used it as below. Can I do better than this?

Code:
Set oIE = CreateObject("InternetExplorer.Application")
oIE.visible=true
oIE.navigate "Some URL......."

Thanks,
Subha
#8
Solved: 11 Years, 4 Months ago
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.
#9
Solved: 11 Years, 4 Months ago
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.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Multiple rows of test data Bhuvana 0 1,341 01-03-2020, 09:30 PM
Last Post: Bhuvana
  issue with IE when running test eiko 2 1,582 02-01-2018, 04:46 PM
Last Post: eiko
  Updating Shared repository vinod_3466 3 4,528 06-29-2016, 02:16 PM
Last Post: Ankesh
  QTP 11 - CreateFolder fails to create folder in shared network drive from Windows 7 Pallavi 3 3,609 02-25-2014, 02:04 PM
Last Post: guin.anirban
  How do I save name and email address in QTP ? Shiv Y 1 2,500 12-19-2013, 07:24 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)