jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erez Naim" <e...@theneura.com>
Subject RE: __StringFromFile behavior changes with if condition in Bean Shell
Date Mon, 02 Feb 2015 16:33:40 GMT
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:skchoppala@gmail.com] 
Sent: Monday, February 02, 2015 5:52 PM
To: jmeter-user@jakarta.apache.org
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: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Mime
View raw message