Can any one help in creating sequence of strings in multiple lines in a file using Beanshell Script
For example: Looking for output of
Test1,Test2,Test3
Test4,Test5,Test6
Test7,Test8,Test9
Tried this but giving incorrect result
int numSets = 1;
for (int j = 1; j < numSets; j++) {
for (int i = 1; i <= numStrings; i++) {
String str = "test" + i;
if (i < numStrings) {
result += str + ",";
} else {
result += str;
}
out.write(str);
}
out.write("\n");
}
out.close();
Be informed that since JMeter 3.1 you should be using JSR223 Test Elements and Groovy language for scripting.
Here is an example solution in Groovy:
More information: Beanshell vs. JSR223 vs. Java For JMeter: Complete Showdown
If you want to print it to jmeter.log file or to another file you can use StringBuilder.append() instead of
print()