Hi,
I have build a database checkpoint and want to make my query dynamic to check if backend and front-end data matches with each other for different set of values. How can I make it happen?
Thanks.
Hi,
I have build a database checkpoint and want to make my query dynamic to check if backend and front-end data matches with each other for different set of values. How can I make it happen?
Thanks.
write the query in database check point and pass it as parameter, your query looks dynamic
please dont give uncomplete answers. it will give more confuse. when u r going to answer pls try to give with full explanation. if possible try to write script also.
then only it will usefull. other it is not and it will give confuse.
Iam new to QTP. I am testing a web application which shows orders created inside a grid.I want to know how to compare values from db with the application. I have tried db checkpoint. This will fail if a new row is added or deleted from the applcation. How to take the runtime property and compare? Please help me out. I also need a dynamic query for db checkpoint which can compare with the application with latest values
Take the below function and modify for your need (shame on me that I never tried to use database checkpoint). The below function was designed for dynamically used:
1) make connection to database instances - dbs (param) I used three different env
2) query database(s) base on your querries - add more querry to the select block if you need
3) return the querry value - if you want to return more than one value you need to modify the querry and adodb object.
Example, i want to validate uid on the web page with uid in database.
Dbuid = getdbdata(1, 1) -> this will get uid from database
webuid = browser(b).page(p).webtable(w).getcelldata(row,col) - don't know how to work with grid
use (if...else) to validate of the two above uid(s) for your need. ========
===============
Function getdbdata(dbs, hitdb)
dim whatIwant
set objcon=createobject("adodb.connection")
set objrec=createobject("adodb.recordset")
select case dbs
case 1 ' test env
objcon.open "driver=microsoft odbc for oracle;server=sname;uid=uid;pwd= pwd"
case 2 ' developer env
objcon.open "driver=microsoft odbc for oracle;server=sname;uid=uid;pwd=pwd"
case 3 ' pilot env
objcon.open "driver=microsoft odbc for oracle;server=sname;uid=uid;pwd=pwd"
case else
msgbox("invalid db env")
existtest
end select
wait(3)
select case hitdb
case 1 ' get account id
objrec.open "select acctid as wanted from myacct where lname = 'test' ", objcon
case 2 ' get lname
objrec.open "select lname as wanted from myacct where uid = 'test01' ", objcon
end select
wait(3)
whatIwant = objrec.fields.item("wanted")
'msgbox dbid
' flush out
objrec.close
objcon.close
set objrec=nothing
set objcon=nothing
getdbdata = whatIwant
End Function
Last edited by learqtptesting; 08-05-2009 at 05:55 PM.