Micro Focus QTP (UFT) Forums
Parameterization - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Parameterization (/Thread-Parameterization--3411)



Parameterization - vijayendra.shukla - 06-02-2010

Hi,

I have written the below code to do some hands-on for parameterization:

Code:
DataTable.ImportSheet "C:\Documents and Settings\a8vs9\Desktop\Vijayendra\Data_Transfer_QTP.xls", "Sheet1", "Global"

If DataTable.GlobalSheet.GetCurrentRow = 1 Then
    SystemUtil.Run "IEXPLORE.exe", "http://www.google.com"
End If
iValue = DataTable.Value("LN_NBR", dtGlobalSheet)
With Browser("title:=Google", "index:=0").Page("title:=Google", "index:=0")

    .WebEdit("name:=q").Set DataTable("LN_NBR")
    .WebEdit("name:=q").Submit
    
End with

If Browser("title:=" & iValue & " - Google Search", "index:=0").Exist(10) Then
    Reporter.ReportEvent micPass, "Iteration " & DataTable.GlobalSheet.GetCurrentRow, "This iteration " & DataTable.GlobalSheet.GetCurrentRow & " is ok."
'    Browser("title:=" & iValue & " - Google Search").Back
    Browser("title:=" & iValue & " - Google Search").Navigate "http://www.google.com"
End If

From the Settings, I have changed the option in the Run tab to "Run on all rows", but still this block of code gets executed only once.

There are 20 values getting imported from the external file. I thought QTP automatically takes up the next row value and runs all the iterations. Please help me.

Thanks,
Vijayendra.


RE: Parameterization - chanda Hemke - 06-02-2010

Make sure that in the keyword view of ur Test , right click Action 1 or whtever is ur action name--> select action call propertis -->run on all rows is selected...


RE: Parameterization - vijayendra.shukla - 06-03-2010

That solved my problem. Thank you for your help.


RE: Parameterization - vijayendra.shukla - 06-03-2010

I did some tweaking with the code. Now what i have done is added two new parameters to the "Action1" (Local Sheet). Now based upon the If-Else logic, I am writing the output to the local sheet parameters.

Now, when i do this, script is not running on all rows. Once again it exits after the first iteration.

What should I do now?

Here is the code:

Code:
DataTable.ImportSheet "C:\Documents and Settings\a8vs9\Desktop\Vijayendra\Data_Transfer_QTP.xls", "Sheet1", "Global"

DataTable.LocalSheet.AddParameter "Status", "1"
DataTable.LocalSheet.AddParameter "Non_Status", "1"

'For i = 1 To iRows

    If DataTable.GlobalSheet.GetCurrentRow = 1 Then
        SystemUtil.Run "IEXPLORE.exe", "http://www.google.com"
        Wait(5)
    End If
    
    iValue = DataTable.Value("LN_NBR", dtGlobalSheet)
    
    With Browser("title:=Google", "index:=0").Page("title:=Google", "index:=0")
    
        .WebEdit("name:=q").Set DataTable("LN_NBR")
        .WebEdit("name:=q").Submit
        
    End with
    
    Wait(1)
    
    If Browser("title:=" & iValue & " - Google Search", "index:=0").Exist(3) Then
        Reporter.ReportEvent micPass, "Iteration " & DataTable.GlobalSheet.GetCurrentRow, "This iteration " & DataTable.GlobalSheet.GetCurrentRow & " is ok."
        If (DataTable.GlobalSheet.GetCurrentRow) Mod 2 <> 0 Then
            DataTable.Value("Status", dtLocalSheet) = iValue - 1
        Else
            DataTable.Value("Non_Status", dtLocalSheet) = iValue - 10
        End If
        
        DataTable.GetSheet(dtGlobalSheet).Activate
    '    Browser("title:=" & iValue & " - Google Search").Back
        Browser("title:=" & iValue & " - Google Search").Navigate "http://www.google.com"
        
        Wait(1)

        
    End If
    DataTable.GetSheet(dtGlobalSheet).SetNextRow
'Next

Browser("title:=Google", "index:=0").Close
DataTable.ExportSheet "C:\Documents and Settings\a8vs9\Desktop\Vijayendra\Data_Transfer_QTP.xls", 2



RE: Parameterization - vijayendra.shukla - 06-04-2010

Anybody??? Any idea on this???Rolleyes