Passing JMeter user variable across beanshell script in different threads

StackOverflow https://stackoverflow.com/questions/16584654

  •  29-05-2022
  •  | 
  •  

سؤال

What I'm trying to do is pass variable between the threads in JMeter - so one thread modify this value and next one will get it - please look at this structure:

Test Plan
    User Defined Variables
    Thread Group 1
        BSF PreProcessor
    Thread Group 2
        HTTP Request
  1. User Defined Variables:

    Name:  myvar
    Value: foo
    
  2. Thread Group 1 -> BSF PreProcessor:

    Script: vars.put("myvar","users");

  3. Thread Group 2 -> HTTP Request:

    Path: /api/${myvar}

What I've got from Thread Group 2 step - variable myvar with default value:

${myvar} == foo

but I want to persist value assigned to variable myvar in Thread Group 1 step so in Thread Group 2 I will get:

${myvar} == users
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top