Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP AOM related Question - need solution
#1
Solved: 11 Years, 4 Months ago
I have QTP Fraemwork related query, I already developed a code which dynamically load repositories,add library file and it is working fine.
But while generating the code I came up with lot of questions.

please read the code what i developed

sample.vbs file -
Code:
EnvXMLfile = "C:\properties.xml"
libraryfile = "C:\\commonLibraryFunctions.vbs"
Set qtp_App = CreateObject("QuickTest.Application")
qtp_App.launch
qtp_App.Visible = True

qtp_App.Open "C:\sampletest",true,false
qtp_App.Test.Environment.LoadFromFile(EnvXMLfile)

qtp_App.Test.Settings.Resources.Libraries.RemoveAll
qtp_App.Test.Settings.Resources.Libraries.Add(libraryfile)
qtp_App.Test.Actions(1).ObjectRepositories.RemoveAll
qtp_App.Test.Actions(1).ObjectRepositories.Add "C:\Shared OR.tsr"
qtp_App.Test.Run


Now my questions are :

1. even though loading environmental file dynamically it will not show value in the QTP script, not able getting any values for environment veriable , but it is added dynamically ?

2.here i add .tsr file for one action , but a test can have multiple action , how could I associate that .tsr file for all the action with in the same test ?

3. even test can have some external action which is belongs to some different test and that test can have others .tsr file.
How could I handle it ?

Please answer my all above question and since I am new, I am trying to develope this piece of code.


Thanks in advance .....
Reply
#2
Solved: 11 Years, 4 Months ago
I am not sure about your first question. Find the rest of the answers
2:
To associate OR to multiple actions you have to write for each action
Like:
Code:
qtp_App.Test.Actions(1).ObjectRepositories.Add "C:\Shared OR.tsr"
qtp_App.Test.Actions(2).ObjectRepositories.Add "C:\Shared OR.tsr"

Here you can also write action name in the bracket instead of action index.

3.
if you use external action then there is no way you can use associate OR for that external action.
You have to use the OR which are already associated with external action.
Reply
#3
Solved: 11 Years, 4 Months ago
Thanks for your answer.But I have question regarding your 2nd point.
qtp_App.Test.Actions(1).ObjectRepositories.Add "C:\Shared OR.tsr"
qtp_App.Test.Actions(2).ObjectRepositories.Add "C:\Shared OR.tsr"
I dont want to do that way because I called the startup.vbs file where
.tsr file will will be added and diff test can have diff number of action
so I want to make it duynamically ..
Is there any way to find out how many action have within a single test
so that when I run the vbs file from outside for a perticular test , its automatically associate .tsr file to all the actions for called test.

and regarding you 1st point I wanted to say ,
I associate a environmental file (.xml) into running test but in script when i want to see the environment value by suing msgbox like
val = environment("anyveriable")
msgbox val
I dont get any value but I added dynamically environmental file and it is showing in test setting also.
Am I doing anything wrong ?
Please put some light these 2 points what I said.

Thanks in advance ......
Reply
#4
Solved: 11 Years, 4 Months ago
You can use For i = 1 to qtp_app.Test.Actions.Count to get number of actions in script.

Regarding your second point you should be able to use xml environment file. As there is no error coming i will not be able to give you answer unless you send me your vbs file.

you can try with .ini text file to environment variable.
Reply
#5
Solved: 11 Years, 4 Months ago
Thanks for your reply . point no 2 what you said its perfectly working.
in case of point no 3, Please find the sample script below:
Code:
[b]EnvXMLfile = "C:\ncs-stream-test\istarncsqtp\tests\common\properties.xml"[/b]
libraryfile = "C:\istar-gv-MUN\istar-gv\munqtp\tests\lib\commonLibraryFunctions.vbs"
Set qtp_App = CreateObject("QuickTest.Application")
qtp_App.launch
qtp_App.Visible = True
'Object.Open TestPath,OpenInReadOnlyMode,SaveCurrent
qtp_App.Open "C:\sampletest",false,false
[b]qtp_App.Test.Environment.LoadFromFile(EnvXMLfile)[/b]

qtp_App.Test.Settings.Resources.Libraries.RemoveAll
qtp_App.Test.Settings.Resources.Libraries.Add(libraryfile)
' find out number of actions in a perticular test
For i=1 To qtp_App.Test.Actions.Count
  qtp_App.Test.Actions(i).ObjectRepositories.RemoveAll
  qtp_App.Test.Actions(i).ObjectRepositories.Add "C:\Shared OR.tsr"
Next
qtp_App.Test.Run


Now I added environment xml file dynamically.
Just to check whether its added or not I put one msgbox inside qtp script
like :
Code:
[b]val = Environment.Value("xenosUrl")
msgbox val[/b]
browser("ISTAR GV").Page("ISTAR GV").WebEdit("j_username").Set "istar"
browser("ISTAR GV").Page("ISTAR GV").WebEdit("j_password").Set "istar"
browser("ISTAR GV").Page("ISTAR GV").Link("Login").Click



Now I didnt get any value for this msgbox but not getting any error also.
I dont know why ...
But if i added through test setting then i got the value.
for your understanding also attached one doc file that provides a snapshot that msg box does not display actual value.
I will try .ini what you have said earlier but I just wanted know why this is not working ?

Thanks for your effort and help.


Attached Files
.doc   Env_XML.doc (Size: 57 KB / Downloads: 87)
Reply
#6
Solved: 11 Years, 4 Months ago
first see whether value for the variable xenosUrl is available. you can even try with some other variable from the xml as script code looks fine.
Reply
#7
Solved: 11 Years, 4 Months ago
Thanks again.
Yes I checked, If i added environment xml through test setting before starting start.vbs file, I meant to say I added static way .not using dynamically throuigh .vbs file.It will show the value.
But while adding through .vbs file It will not showing the value.

Thanks in advance
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Scrambled characters in uft Solution Explorer Dwarak Calayampundi 0 1,540 05-25-2016, 05:02 AM
Last Post: Dwarak Calayampundi
  QTP not selecting appropriate webelement from the webtable..Need Solution satishkumarm 11 21,640 03-23-2016, 12:47 PM
Last Post: Swetha_Bayya
  QTP system related issue Bharathi Kanagarajan 1 2,096 09-12-2015, 11:28 PM
Last Post: ADITI1992
  AOM script is running only one or two scripts. jramya 4 4,148 07-24-2014, 06:15 PM
Last Post: jramya
  Issue related to dropdown selection(Please help urgent) excellentpawan123 2 4,293 05-31-2014, 12:00 PM
Last Post: excellentpawan123

Forum Jump:


Users browsing this thread: 1 Guest(s)