write a VBscript code to parametrize test script using test
data from sqlserver database?

Answers were Sorted based on User's Feedback



write a VBscript code to parametrize test script using test data from sqlserver database?..

Answer / kamesh n

first connect to database using the following script


set sqlconnection=createobject("ADODB.connection")
set sqlrecordset=createobject("ADODB.recordset")

To open the connection

sqlconnection.open "You have to mention your database
connection string"

sqlrecordset.open "Give your query",sqlconnection

to run through all the records

if not sqlrecordset.EOF then


suppose your are going to set it to a textbox then

Browser(browsername).page(pagetitle).webedit
(testboxname).set sqlrecordset(columnname)


end if

Is This Answer Correct ?    8 Yes 1 No

write a VBscript code to parametrize test script using test data from sqlserver database?..

Answer / rajh

dim con,rec
set con=create object("adodb.connection")
set rec=create object("adodb.recordset")
con.open"provider=sqloledb.1;server=name;username=scott;pwd=tiger;database=dbname'
rec.open"sql statement"con
while not rec.eof
window("winmame").winedit("uname").set rs.fields(un)
in the same way use the data
loop

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More QTP Interview Questions

How many types of Check Point in QTP

2 Answers   R Systems,


what is the mail use of frame work(with detail). architecture for keyword driven frame work

0 Answers   Persistent,


Excel sheet having some datas and some datas present in the application (in table). How will you compare these two datas? Write code to fetch datas from Excel sheet.

0 Answers  


what is Unicoad Compatibility ???? HOw does this makes a diffrence from Winrunner.???

1 Answers   GE,


Hi Friends, How to trap an error message on Web page through QTP. Example:- When I put wrong user id or Password on a web page, I get the error message. So when I add the error object in Reposatory, every time it shows as Login Failed Object exist, eventhough using corret login details. And if I do the same without adding the object it shows as object not found. This might be because while recording QTP takes every new page as _1 _2 _3 and so on. as below. Browser("XXXXX").Page("XXXXX_1"). >>login Browser("XXXXX").Page("XXXXX_2"). >>Inbox Browser("XXXXX").Page("XXXXX_3"). >>Sent Items I used below code. Browser("XXXXX").Page("XXXXX").WebEdit("firstname").Set strFN Browser("XXXXX").Page("XXXXX").WebEdit("lastname").Set strLN Browser("XXXXX").Page("XXXXX").WebEdit("userid").Set strUserID Browser("XXXXX").Page("XXXXX").WebEdit("password").Set strPass Browser("XXXXX").Page("XXXXX").WebButton("Login >").Click If Browser("XXXXX").Page("XXXXX_2").Image ("msg_icon_error").Exist 5 Then Reporter.ReportEvent micFail, "XXXXX", "Login Failed!" ExitRun (It shows login failed ever after login is passed. Else Reporter.ReportEvent micPass, "XXXXX", "Login Successful!" End If Please find out a way for me here, and provide me with the correct code. Thanks in Advance.

1 Answers  






Give me brief idea about QTP automation object model?

5 Answers   TCS,


Hi Friends, If you got one Bug , and you are insert that bug in bug tracking tool , and you need to attach SC's (screen shots) also. how to tae SC's , in your organization any separate tools available to take SC's. please provide Ans. its urgent... Thanx in advance

3 Answers  


How does quicktest professional (qtp) identifies the object in the application?

0 Answers  


plz tel me what is the differnce between QC & QTP?

3 Answers   iGate, Satyam,


How to apporach while starting the automation testing?

3 Answers   Patni,


how to capture data from images in QTP and produce them in excel sheet?

3 Answers  


What is RTM (require ment tracebulity marix) fromate?

0 Answers   Wipro,


Categories