Forum Discussion

wdc's avatar
wdc
Occasional Contributor
7 years ago
Solved

Data-Driven Loop

I have created a Data-Driven loop to read a .csv file.  For each record read, I want to use the data as a parameter for a TestedApp. I have tried many different things to no avail.  Any suggestions?   Thanks in advance!

  • OK... I see your problem.  Change the line I've marked in bold

     

    Data Driven Loop (I read 5 records in the csv file.For each loop 

        Run Code Snippet:  TestedApps.WWCabinetDoorOrder.Params.ActiveParams.CommandLineParameters =      KeywordTests.TransferOrders.Variables.LoopOrdersToTransfer.Value(0)  

        Run Code Snippet: TestedApps.WWCabinetDoorOrder.Run()

     

    Note the parenthesis on the "Run" method.  In my reproduction, if you don't have that, the application runs, but it doesn't use the parameters.

10 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    It helps if you tell us what you tried, what happened when you did that, and what you expected to happen instead.  

  • shankar_r's avatar
    shankar_r
    Community Hero

    What kind of TestedApps you are using? It differs for each type. like Java WebStart, Windows App

    • wdc's avatar
      wdc
      Occasional Contributor

      Within the Data Loop, I run 2 code snippets.

       

      1.  TestedApps.WWCabinetDoorOrder.Params.ActiveParams.CommandLineParameters = KeywordTests.TransferOrders.Variables.LoopOrdersToTransfer.Value()

       

      2.  TestedApps.WWCabinetDoorOrder.Run

       

      It seems to be skipping #1, but executes #2 correctly for each record in the loop. The parameter is stored in the .csv file that is read in the loop.  I just don't know how to load that parameter before executing #2.

       

      This is a visual studio .net desktop executable.

       

      Thanks

       

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        You have this:

        KeywordTests.TransferOrders.Variables.LoopOrdersToTransfer.Value()

         

        But... value of what? When doing a loop like you're doing, the Value method has a parameter to indicate what column within the source data you want to obtain the value for.  You're missing that parameter.