JMeter - compute a variable using another variable

I have 5 thread groups, and I want the number of threads in each group to be derived from the total number of users.

Therefore, I do not need to change the numbers in each thread group each time I change the number of users.

So, I defined 6 variables in my test plan:

1. TOTAL_NUMBER_OF_USERS = ${__P(num_of_users,100)} 2. WEIGHT_OF_GROUP_1 = ${__P(weight1,0.2)} 3. ... 4. ... 5. ... 6. WEIGHT_OF_GROUP_6 = ${__P(weight6,0.2)} 

and than in the field of the thread group Number of threads(users) , which I put - ${WEIGHT_OF_GROUP_1}*${TOTAL_NUMBER_OF_USERS} .

When I run the test plan, I see in the log that the number of threads has been interpreted as 0 .

I tried using evalVar or doing the calculation in the place where I define the variables, but that didn't work.

Any idea how to do this?

+6
source share
1 answer

Use __BeanShell if you need calculations:

+4
source

Source: https://habr.com/ru/post/947221/


All Articles