Results 1 to 10 of 10

Thread: How to pass parameters from excel sheet into an application form through qtp(code)

  1. #1
    HI 2 all

    How to pass parameters from excel sheet into an application form through qtp. i need code to perform this task.so plz help me......

    bye

    Last edited by jainbrijesh; 09-18-2007 at 05:15 AM.

  2. #2
    Expert Member
    Join Date
    Nov 2006
    Answers
    518

    Re: How to pass parameters from excel sheet into an application form through qtp(code

    I think you are talking about data driven testing

    Lack of WILL POWER has caused more failure than
    lack of INTELLIGENCE or ABILITY.

    -sutnarcha-

  3. #3

    Re: How to pass parameters from excel sheet into an application form through qtp(code

    hi thanx for replying yes data driven testing..iam new to qtp.if uknow plz help me out if possible.


    thanx

    bye


  4. #4
    Junior Member
    Join Date
    Feb 2007
    Answers
    3
    Quote Originally Posted by chundikirankumar View Post
    HI 2 all

    How to pass parameters from excel sheet into an application form through qtp. i need code to perform this task.so plz help me......




    bye
    Hi kiran,
    better to select datadriver option.
    i think u understand.
    by
    chalapathi.

    Last edited by jainbrijesh; 09-18-2007 at 05:16 AM.

  5. #5
    Contributing Member
    Join Date
    Feb 2006
    Answers
    33

    Re: How to pass parameters from excel sheet into an application form through qtp(code

    You need to create objects in Excel to do that as follows -

    set sh = CreateObject("Scripting.FileSystemObject")
    set exl = CreateObject("Excel.Application")
    exl.visible = true

    excel_path = Datatable.Value("p_path_mainxls")

    set wb = exl.WorkBooks.Open(excel_path)

    'Open the intended worksheet
    set ws_content = wb.Worksheets("Sheet1")

    ws_content.Activate

    list_value = exl.ActiveSheet.Cells(5,4).Value

    'Then you can use this list_value to pass onto the application like,
    Browser().Page().WebEdit().Set list_value


  6. #6
    Expert Member
    Join Date
    Nov 2006
    Answers
    518

    Re: How to pass parameters from excel sheet into an application form through qtp(code

    dsharma's examples are correct

    If the data is to be taken from QTP's Data Table, then the following statement should help you...

    Window("XYZ ABC").Dialog("OPEN").WinEdit("Edit").Set DataTable("A", dtGlobalSheet)

    Lack of WILL POWER has caused more failure than
    lack of INTELLIGENCE or ABILITY.

    -sutnarcha-

  7. #7
    Contributing Member
    Join Date
    Mar 2007
    Answers
    35

    Re: How to pass parameters from excel sheet into an application form through qtp(code

    hi below is the code, if ur external datatable contian more than one iteration....

    DataTable.Importsheet "Path of the excel.Xls","Sourcesheet",Designationsheet",

    iRowCnt = DataTable.GetSheet.GetRowCount

    For iNumber=1 to iRowCnt

    DataTable.SetCurrentRow(iNumber)
    v_iretriveValFrmDataTable = DataTable("ColumnName","")

    Next


  8. #8
    Contributing Member
    Join Date
    Feb 2006
    Answers
    85

    Re: How to pass parameters from excel sheet into an application form through qtp(code

    Also there is one easy way is follow what the process mentioned in the QTP help book. thats the easiest way to start working on the Data Driven Testing.


  9. #9
    Contributing Member
    Join Date
    Feb 2006
    Answers
    41

    Re: How to pass parameters from excel sheet into an application form through qtp(code

    Whatever dsharma has written the code is correct and it works properly.

    Arun*


  10. #10
    Junior Member
    Join Date
    Jul 2007
    Answers
    3

    Re: How to pass parameters from excel sheet into an application form through qtp(code

    hi

    plz try this once

    DataTable.AddSheet"login"
    DataTable.ImportSheet"C:\Documents and Settings\Administrator\Desktop\Book1.xls","input","login"
    rc=DataTable.GetSheet("login”).Getrowcount
    For i=1 to rc
    DataTable.SetCurrentRow(i)
    systemutil.Run"C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
    Dialog("Login").Activate
    Dialog("Login").WinEdit("Agent Name:").Set DataTable("UserId",3)
    Dialog("Login").WinEdit("Password:").SetSecure DataTable("Password",3)
    Dialog("Login").WinButton("OK").Click
    If (Window("Flight Reservation").Exist) then
    reporter.ReportEvent 0,"Given Test is ","pass"
    DataTable.Value("Result",3)="pass"
    else
    reporter.ReportEvent 1,"Given Test is ","fail"
    DataTable.Value("Result",3)="fail"
    end if
    Window("Flight Reservation").Close
    DataTable.SetNextRow
    next
    DataTable.ExportSheet"c:\Documents and Settings\Administrator\Desktop\Book1.xls",3



    Regards
    gopathi


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