0
votes

I want to set Duration for test working. In my Thread Group I set

  • Number of Threads = 1
  • Ramp-up period = 0
  • checked 'Forever'
  • checked 'Scheduler'
  • Duration = 10
  • Startup delay = 0

So if test needs more than 10 seconds to be finished, elapsed time is quit right - 10 second. BUT if it needs, for example, 5 seconds, it stops after 5 seconds, not after 10 as I expect.

How to make script to work until Duration time elapsed?

UPD. Screenshot of Thread Group settings

Logs for last running:

2017/04/11 19:53:33 INFO  - jmeter.engine.StandardJMeterEngine: Running the test! 
2017/04/11 19:53:33 INFO  - jmeter.samplers.SampleEvent: List of sample_variables: [] 
2017/04/11 19:53:33 INFO  - jmeter.gui.util.JMeterMenuBar: setRunning(true,*local*) 
2017/04/11 19:53:33 INFO  - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group 
2017/04/11 19:53:33 INFO  - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group Thread Group. 
2017/04/11 19:53:33 INFO  - jmeter.engine.StandardJMeterEngine: Thread will continue on error 
2017/04/11 19:53:33 INFO  - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 0 perThread 0.0 delayedStart=false 
2017/04/11 19:53:33 INFO  - jmeter.threads.ThreadGroup: Started thread group number 1 
2017/04/11 19:53:33 INFO  - jmeter.engine.StandardJMeterEngine: All thread groups have been started 
2017/04/11 19:53:33 INFO  - jmeter.threads.JMeterThread: Thread started: Thread Group 1-1 
2017/04/11 19:53:33 INFO  - jmeter.services.FileServer: Stored: data.txt 
2017/04/11 19:53:40 INFO  - jmeter.threads.JMeterThread: Stop Thread seen for thread Thread Group 1-1, reason:org.apache.jorphan.util.JMeterStopThreadException: End of file:data.txt detected for CSV DataSet:CSV get parameter for request configured with stopThread:true, recycle:false 
2017/04/11 19:53:40 INFO  - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-1 
2017/04/11 19:53:40 INFO  - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test 
2017/04/11 19:53:40 INFO  - jmeter.services.FileServer: Close: data.txt 
2017/04/11 19:53:40 INFO  - jmeter.gui.util.JMeterMenuBar: setRunning(false,*local*) 
1
What did you try? Show your code.planetmaker
JMeter runs the thread group until either the number of loops is reached or the duration/end-time is reached - whichever occurs first.NaveenKumar Namachivayam
@planetmaker, I posted a screenshot of GUI with Thread Group settings and with Test Plan tree. I use GUI for my purposes. If you mean I should show my .jmx file, I can do it.Gleb
@NaveenKumarNamachivayam, I checked 'Forever' instead of setting Loop Count. It's a point of my problem - JMeter sometimes stops before duration is reached. I read manual and it says: Note those 2 options override the Start time and End time. jmeter.apache.org/usermanual/test_plan.htmlGleb

1 Answers

0
votes

Given you set Loop Count as "Forever" your test should run for 10 seconds (or even more if JMeter will need to gracefully shutdown a lot of samplers) so my expectation is that either error occurs or you are using some form of test end logic like If Controller of Test Action sampler which trigger premature stop.

When JMeter behaves in a unexpected manner remember always to check jmeter.log file - normally it contains enough troubleshooting information. If you are not able to figure out the reason yourself - post the log file here.

As an alternative you could try Ultimate Thread Group which provides more advanced way of defining the load pattern and it comes with the anticipated load chart.

The Ultimate Thread Group (as well as any other plugin) can be installed using JMeter Plugins Manager

JMeter Custom Thread Groups