Results 1 to 6 of 6

Thread: Database Checkpoint dynamic query

  1. #1
    Junior Member
    Join Date
    Sep 2007
    Answers
    2

    Database Checkpoint dynamic query

    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.


  2. #2
    Junior Member
    Join Date
    Sep 2007
    Answers
    1

    Re: Database Checkpoint dynamic query

    write the query in database check point and pass it as parameter, your query looks dynamic


  3. #3

    Re: Database Checkpoint dynamic query

    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.


  4. #4
    Junior Member
    Join Date
    Aug 2009
    Answers
    2

    Re: Database Checkpoint dynamic query

    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


  5. #5
    Expert Member
    Join Date
    Jun 2008
    Answers
    204

    Re: Database Checkpoint dynamic query

    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.

  6. #6
    Expert Member
    Join Date
    Apr 2008
    Answers
    1,859

    Re: Database Checkpoint dynamic query

    hai friend,

    Quote Originally Posted by learqtptesting View Post
    (shame on me that I never tried to use database checkpoint). End Function
    There is no need to get shamed database checkpoint is not at all recommended in real time.

    Thanks
    Deepa


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact