Quality Testing

Quality is delighting customers

I have two test cases: Google1  and Yahoo1

In the cases I have codes like:

Google1-

SystemUtil.Run"iexplore.exe", "www.google.com"

Browser("Google").Page("Google").WebEdit("q").Set (Arr1(1))

Browser("Google").Page("Google").WebButton("Google Search").Click

 

Yahoo1 -

SystemUtil.Run("iexplore.exe"), ("www.yahoo.com")

Browser("Yahoo!").Page("Yahoo!").WebEdit("p").Set(Arr1(1))

Browser("Yahoo!").Page("Yahoo!").WebButton("Search").Click

 

I have two text files. In text file "path" I have the test cases paths as-

C:\Documents and Settings\Administrator\My Documents\Unified Functional Testing\Google1

C:\Documents and Settings\Administrator\My Documents\Unified Functional Testing\Yahoo1

in text file "Credentials" I have the -

Google1: Morning

Yahoo1: Evening

In a .vbs File I have these codes-

Set objQtp=CreateObject("QuickTest.Application")

Set objFSO=CreateObject("Scripting.FileSystemObject")

Set objTS=objFSO.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\path.txt",1)

Set objTD=objFSO.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\Credentials.txt",1)

objQtp.Launch

objQtp.Visible=True

Do Until objTS.AtEndOfStream=True

Do Until objTD.AtEndOfStream=True

                objQtp.Open objTS.ReadLine

                Arr1=Split(objTD.ReadLine,":") 

        objQtp.Test.Run

              If Environment("TestName") = Arr1(0) Then

            

            

 

         

             

             

                               

                End If   

                      objQtp.Test.Close    

Loop

Loop

objQtp.Quit

Set objTD=Nothing

Set objTS=Nothing

Set objFSO=Nothing

Set objQtp=Nothing

 

 

Now my question is I want to execute the test cases from the .vbs file and then want to pass the credential data which is Arr1(1) here to the wed edit boxes when Arr1(0)=Environment("TestName"). But I am totally confused how to do this. Another thing when I run this .vbs file it throws an error saying either Type Mismatch "Environment" or object required "Environment". Please help me to solve this problem. Thanks in advance.

 

 

 

 

 

 

Views: 316

Reply to This

Replies to This Discussion

Here is what i understood your problem.

You wanted to pass some data from VBS file to QTP test script.  correct?

If yes, they way you are passing data using environment variable is not possible.  You are linking two difference interfaces.

Launching QTP from VB Script is called AOM.  QTP has given separate Test Args component to pass data between VBS file and QTP Test Script file for Input and Output parameters.  Just like Action Input & Output parameters.

Google QTP TestArgs you definitely get some help.

--Subbu.

 First of all thanks for your reply. Yes I wanted to pass some data from VBS file to QTP test script. I do not want to pass data by environment variable, but i want to make sure that test case names do not contradict When the test case names will match date related to that particular test will be passed to the edit box for search. Can you please help me to solve this problem? and Why I am getting the runtime error?

There was no command / function named Environment in VB Script.  You should use below object to create test parameters to pass / get any value from VB Script to QTP.

Set rtParams = appQTP.Test.ParameterDefinitions.GetParameters()

Please try yourself that would give huge confidence on you programming and QA skills.  I understand it takes time but it is good for your career.

--Subbu.

thank you for your help. I am trying to solve it. 

Can you please tell me why i am getting error on last line saying "object required"? here is my code:

Dim p
Set objDOM=Browser("title:=.*").Page("title:=.*").Object.getElementsbyTagName("INPUT")

'MsgBox objDOM(1)
For p = 1 To objDOM.length Step 1
editName=objDOM(p).name
'MsgBox editName
Set objIdx=Browser("title:=.*").Page("title:=.*").WebEdit("name:="&editName).Object.sourceIndex

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service