-1

How to make thread group users share single Foreach control, for ex. I have 10 user and one foreach controller for 10K (JDBC request) records, I want to process this 10K records by 10 users(Thread group user) so that each user process 1k records. Presently for my setup with Thread group with 10 user and 1 JDBC request and Foreach controll the total requests are 10 * 10K = 100k which is 10 time repeated.
Thanks for your help.

0

The easiest way would be writing the variables into a file like:

  1. Add If Controller under the ForEach Controller and use the following condition:

    ${__threadNum} == 1
    
  2. Add Test Action Sampler as a child of the If Controller. It will act as a "container" and won't generate any extra sample results in your report
  3. Add JSR223 PreProcessor as a child of the Test Action sampler and put the following code into "Script" area:

    new File('test.csv') << vars.get('foo') << System.getProperty('line.separator') 
    

    Replace foo with what you have as "Output variable name" in the ForEach Controller

  4. Add JDBC Request sampler under the ForEach Controller (the same level)
  5. Add CSV Data Set Config as a child of the JDBC Request sampler and configure it as follows:

    JMeter CSV Data Set Config

    Again, replace foo with the expected variable name (the same as "Output variable name" in the ForEach Controller")

2
  • Dmitri Thanks, It is allowing Thread number 1 only to run with this condition ${__threadNum} == 1, whereas what I am trying is all thread divide the count and run (some what like multi tasking). – user30507 Jan 23 '18 at 11:36
  • what is the use of this "new File('test.csv') << vars.get('foo') << System.getProperty('line.separator') " even I disable this it is working with no difference – user30507 Jan 23 '18 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.