I have created a script and a .csv file based on the example provided here “katalon-recorder-samples-master”. It has a test case called “Test Data”.
When i run it as is - all works nice and all 3 data rows are populated as expected in the sample site Demo AUT.
Now - when i just change a single value inside data.csv - say instead of
|"Wayne" for the column 'last', we enter "Johns", the script fails to run as before.|
This sample has 3 rows in CSV file:
So the short script sample reads from the file and populates id=first-name and id=last-name fields.
But like i said - once i modified the .csv, now it runs 4 iterations instead of 3 and it feels like it "sees" 4 rows in .csv file.
However the 4th time it does not "see" the 'first' column and hence enters no value into id=first-name, but enters "Johns" into id=last-name.
I can’t find anyone else face this issue. It is really annoying - almost like the sample provided is hardcoded to run properly with precisely data in it. The moment - i make a change in the value - it goes for an extra run…
Please see attached screen shots.
Really appreciate any help.
I figured out - somehow the .csv always get the trailing spaces.
Not sure if it is a Defect with the Katalon Recorder or what, but if to open .csv file in the editor such as word-pad and clear the trailing spaces - all works fine.
I battled with the same issue. I had one record of data and the trailing spaces fix did not work, the loop still occurred.
What fixed it for me is to remove the endLoadVars command if there is only one record of data. If there are > 1 records then the endLoadVars loops through each record and the loop ended after the last record.
My problem was solved.
The issue is actually most likely due to Excel in this case.
The way that different applications create CSV files can vary (and Katalon does have a different way of handling CSV files to some other tools on the market, but it does still work the same in principle).
Where an application creates a new line with “,” or the likes then to the CSV parser it has not reached the end of the file (which is the point that endLoadVars stops looping) till it reaches the end of the file.
So yeah for some applications you need to first clean up the CSV created before it will work.
Thanks Andrew, I was also facing this issue when I modified the csv. Your comments really helped