You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2018/12/07 11:42:26 UTC

[Bug 62990] New: Thread group Loop count cant be set by variable generated by Beanshell preprocessor, Jmeter no execute any iteration..

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: ruthan@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.

[Bug 62990] Thread group Loop count cant be set by variable generated by Beanshell preprocessor, Jmeter no execute any iteration..

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62990

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om
                 OS|                            |All
             Status|NEW                         |RESOLVED

--- Comment #1 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
This is not possible by design.

But you could put your Beanshell (better use groovy) code to initialize the var
in User Defined Variables, see:

- http://jmeter.apache.org/usermanual/properties_reference.html#groovy

An alternative if using CSV Data Set, just set :

- Recycle on EOF to false
- Stop Thread on EOF to true

so that once CSV file has been consumed, the threads using it are stopped.

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

[Bug 62990] Thread group Loop count cant be set by variable generated by Beanshell preprocessor, Jmeter no execute any iteration..

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62990

--- Comment #2 from RuThaNiel van den Naar <ru...@email.cz> ---
So pleas at least improve logging, that something unsupported was done, because
now, user just cant start the script run a dont know why.

 Beanshell / Groovy in User Defined Variables, is multi command syntax
supported, is Beanshell variable definition supported, is import supported? How
to just port my Beanshell code to it?

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