Hi, Maybe you should use Counter Sampler and set it to 20 then use a while loop controller and foreach iteration just subtract -1 from the counter then at the end of the while loop it will print the line that you requested for.
Hope that's help! -----Original Message----- From: skchoppala [mailto:[email protected]] Sent: Monday, February 02, 2015 5:52 PM To: [email protected] Subject: __StringFromFile behavior changes with if condition in Bean Shell Hi, I am having problem using __StringFromFile in a bean shell. My requirement is to use the first line of the file 20 times and go for next line when the counter rest to 0. I have my bean shell sampler in while controller. If the function is out side of if condition it returns next line of the file for each iteration. But if the function is in side if condition it returns first line agin after the if condition satisfied. I appreciate your help. int counter = Integer.parseInt(vars.get("keyCounter")); apiKey="dummy"; if ( counter == 0 ) { apiKey="${__StringFromFile(/DataSource/API_KEYS.csv)}"; } else { apiKey = vars.get("nextAPIKey"); } vars.put("nextAPIKey",apiKey); -- View this message in context: http://jmeter.512774.n5.nabble.com/StringFromFile-behavior-changes-with-if-c ondition-in-Bean-Shell-tp5721737.html Sent from the JMeter - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
