https://bz.apache.org/bugzilla/show_bug.cgi?id=62990

            Bug ID: 62990
           Summary: Thread group Loop count cant be set by variable
                    generated by Beanshell preprocessor, Jmeter no execute
                    any iteration..
           Product: JMeter
           Version: 5.0
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Main
          Assignee: issues@jmeter.apache.org
          Reporter: rut...@email.cz
  Target Milestone: JMETER_5.1

Hello,
i have problem to set Thread group loop count by value generated by Beanshell
preprocesor, i tried to add delay to thread scheduler, its the same. I can see
right variable value in Debug sampler. When i run test start, script end after
0 iterations..

  I tried place Beanshell preprocesor on Test plan component or inside Thread
group but its behave the same.

  When i use variable created in User Defined Variables, its working fine. 

  I want to use it for:
- get number of lines in data file and executed exactly same number of
iteration.

Preprocesor code:
import org.apache.commons.io.FileUtils; // necessary import

String DataFilePath=vars.get("ScriptsDirectory")+"Data/DataFile.txt";
log.info(DataFilePath);
int lines = FileUtils.readLines(new File(DataFilePath)).size(); // get lines
count
vars.put("NumberOfLinesInDataFile", String.valueOf(lines)); // store the count
into "lines" variable
log.info("Number of lines in Data file is:"+lines);

 Regarding of Debug sampler it set variable right.

Jmeter log output:
2018-12-07 12:41:09,364 INFO o.a.j.e.StandardJMeterEngine: Running the test!
2018-12-07 12:41:09,364 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2018-12-07 12:41:09,365 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2018-12-07 12:41:09,372 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, *local*)
2018-12-07 12:41:09,510 INFO o.a.j.e.StandardJMeterEngine: Starting
ThreadGroup: 1 : Bazos
2018-12-07 12:41:09,510 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads
for group Bazos.
2018-12-07 12:41:09,510 INFO o.a.j.e.StandardJMeterEngine: Thread will continue
on error
2018-12-07 12:41:09,510 INFO o.a.j.t.ThreadGroup: Starting thread group...
number=1 threads=1 ramp-up=1 perThread=1000.0 delayedStart=false
2018-12-07 12:41:09,516 INFO o.a.j.t.ThreadGroup: Started thread group number 1
2018-12-07 12:41:09,517 INFO o.a.j.e.StandardJMeterEngine: All thread groups
have been started
2018-12-07 12:41:09,520 INFO o.a.j.t.JMeterThread: Thread started: Bazos 1-1
2018-12-07 12:41:09,521 INFO o.a.j.t.JMeterThread: Thread is done: Bazos 1-1
2018-12-07 12:41:09,521 INFO o.a.j.t.JMeterThread: Thread finished: Bazos 1-1
2018-12-07 12:41:09,521 INFO o.a.j.e.StandardJMeterEngine: Notifying test
listeners of end of test
2018-12-07 12:41:09,521 INFO o.a.j.r.Summariser: Generate Summary Results =    
 0 in 00:00:00 = ******/s Avg:     0 Min: 9223372036854775807 Max:
-9223372036854775808 Err:     0 (0.00%)
2018-12-07 12:41:09,522 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false,
*local*)

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to