Forum Discussion
axeltoushirou
10 years agoContributor
I don't think that's how Groovy DataSource works.
Because each row is an execution of the Script that you wrote, each row iterates and gets the last result.
Tested using code below: (each row returned different results, meaning to say, each row executed the script on their own)
char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789".toCharArray();
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < 20; i++) {
char c = chars[random.nextInt(chars.length)];
sb.append(c);
}
String output = sb.toString();
result["data"] = outputso if you try to loop, the loop will end and will return the last data, that happens on each row.