I have 5 thread groups and I want the number of threads in each group to be derived from a total users number.
So I wouldn't need to change the numbers in each thread group every time I change the number of users.
So I defined 6 variables on 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 thread group Number of threads(users)
field I put - ${WEIGHT_OF_GROUP_1}*${TOTAL_NUMBER_OF_USERS}
.
When I start the test plan I can see in the log that the number of threads was interpreted as 0
.
I tried using evalVar
or doing the calculation at the place where I define the variables, but it didn't work.
Any idea how to do this?
Note that variables cannot currently be nested; i.e. ${Var${N}} does not work. The __V (variable) function can be used to do this: ${__V(Var${N})}.
Step to implement the logic for passing the variable value to another Thread Group: Add a 'Regular Expression Extractor' post-processor as a child element of 1.1 HTTP Request (Fetcher) and fetch the value in a variable (say employeeID) Add a 'BeanShell Assertion' and write ${__setProperty(valueToPass,${employeeID})}
Use __BeanShell function if you need computations:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With