Missing CSV loop functionality with Kantu v5.0.1


#1

Hello folks,

Did we lose the ability to loop CSV data when running test suites with the most recent update (5.0.1)? The option isn’t available in the Macros tab (given that the Test Suite tab is deprecated) where my new test suites/folders are.

If I’m wrong, can someone explain how to run test suites using CSV data looping?


#2

The old testsuites are still available, unchanged. But you are correct, the new “folder as testsuites” does not have an integrated Loop feature. The reason is that this is no longer required:

You can use While…end to have a loop inside the macro and read the CSV content this way. The “DemoCsvReadWithWhile” macro shows how this works.

  {
      "Name": "DemoCsvReadWithWhile",
      "CreationDate": "2019-6-4",
      "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_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": ""
        }
      ]
    }

Loop parameter for command line
#3

Ah! So after poking around a bit more, it looks like my issue was that the Test Suites tab was missing my existing test suites/macros (prior to the v5.0.1 update) and I thought that the loop counter was taken out completely. Human error, my apologies.

Saw a console error “Error: No macro found with name 'myMacroName'” when I tried to add a new test suite in the Test Suites tab, so I figured “well, let’s see what happens if I backup my existing Kantu folder (stored on hd) elsewhere, delete the existing directories, and start a new macro and test suite” with the intention of using it as a skeletal framework to re-add my old macros and test suites. I manually added the files from my backup folder into the folder that the Kantu extension is pointing to, and I am now able to run test suites with the “old” loop feature.