jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SanderW <san...@performancearchitecten.nl>
Subject Re: Increment counter by 1 for each test execution.
Date Thu, 08 Jan 2015 14:45:53 GMT
First of all it's not necessary to ask the same question in multiple old
threads.

My suggested way is probably not the most efficient 

Create a new testplan with 2 thread groups and on testplan level make sure
"Run Thread Groups consecutively" is checked.

The first thread group is executed with 1 user and loopcount is 1.
The second thread group contains your script and has name
Administration${__P(runid)}

In the first thread group you have a beanshell sampler with the following
code:

// Get the sequence number from file
FileInputStream in = new FileInputStream("C:/runid.txt");
InputStreamReader inr = new InputStreamReader(in);
BufferedReader br = new BufferedReader(inr);
String line1=br.readLine();
props.put("runid", line1);
inr.close(); 
in.close();

// Overwrite the old file with a new sequence number
f = new FileOutputStream("C:/runid.txt", false);
p = new PrintStream(f);
p.println(Integer.parseInt(line1) + 1);
p.close();
f.close();

Attached is the testplan  Raghu-question.jmx
<http://jmeter.512774.n5.nabble.com/file/n5721606/Raghu-question.jmx>  



--
View this message in context: http://jmeter.512774.n5.nabble.com/Increment-counter-by-1-for-each-test-execution-tp5721603p5721606.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


Mime
View raw message