QUERY: How can I run my test suite/test once for each row within an uploaded csv datasource?

I have a test suite that currently has 2 variables in each macro (each macro has the same 2 variables)

Ideally, I’d like to add a datasource with the variables stored in Col1 and Col2 and have the suite repeat for each row of the datasource csv

So for example, in the datasheet there is:
gbp | en
usa | eu

and when I run a test, or the test suite, it runs twice, the first time using the first row of variables, and the second time, using the second row of variables

Is that possible?

Hi @sooshi. Under the Demo folder in UI.Vision, you can look at DemoCsvReadWithLoop and DemoCsvReadWithWhile and it will have the sample code to do what you require.

Thank you!

(question number 2, how do I get the demo macros back? I deleted them all - I’m regretting that decision now)

Hi. The easiest way is to remove and re-install the add-in. Or just create a new Chrome user and install the add-in, backup, and restore from your Chrome profile. They have it in GitHub but it’s 10 months old so I don’t think that’s up-to-date.

Here’s the 2 that you would need

{
  "Name": "DemoCsvReadWithLoop",
  "CreationDate": "2019-8-28",
  "Commands": [
    {
      "Command": "store",
      "Target": "fast",
      "Value": "!replayspeed"
    },
    {
      "Command": "comment",
      "Target": "The file ReadCSVTestData.csv is pre-installed with Kantu.",
      "Value": ""
    },
    {
      "Command": "csvRead",
      "Target": "ReadCSVTestData.csv",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "Call subroutine for the actual form filling",
      "Value": ""
    },
    {
      "Command": "run",
      "Target": "sub/Sub_DemoCsvRead_FillForm",
      "Value": ""
    }
  ]
}

And

{
  "Name": "DemoCsvReadWithWhile",
  "CreationDate": "2019-8-28",
  "Commands": [
    {
      "Command": "store",
      "Target": "180",
      "Value": "!timeout_macro"
    },
    {
      "Command": "store",
      "Target": "fast",
      "Value": "!replayspeed"
    },
    {
      "Command": "comment",
      "Target": "The file ReadCSVTestData.csv is pre-installed with Kantu.",
      "Value": ""
    },
    {
      "Command": "csvRead",
      "Target": "ReadCSVTestData.csv",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "Status = ${!csvReadStatus}, line = ${!csvReadLineNumber}",
      "Value": ""
    },
    {
      "Command": "while_v2",
      "Target": "${!csvReadStatus} == \"OK\"",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "status = ${!csvReadStatus}, line = ${!csvReadLineNumber}",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "Call subroutine for the actual form filling",
      "Value": ""
    },
    {
      "Command": "run",
      "Target": "sub/Sub_DemoCsvRead_FillForm",
      "Value": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return Number(${!csvReadLineNumber})+1",
      "Value": "!csvReadLineNumber"
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!errorIgnore"
    },
    {
      "Command": "echo",
      "Target": "Reading CSV line No.  ${!csvReadLineNumber} ",
      "Value": "!errorIgnore"
    },
    {
      "Command": "csvRead",
      "Target": "ReadCSVTestData.csv",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "false",
      "Value": "!errorIgnore"
    },
    {
      "Command": "end",
      "Target": "",
      "Value": ""
    }
  ]
}

Great stuff! I think I can work this out from what you’ve shared. Thanks again!!!