Reputation: 47
The problem I'm trying to solve is how to go about randomizing HTTP requests with multiple available values of parameters one would manually select via a drop-down list. I'm doing this in JMeter so AFAIK I cannot just declare an array containing values of parameters that said drop-down list options refer to and then use random indices for values. For the sake of simplifying the problem - let's say I'm writing a test plan where a thread searches for a book title in an e-bookstore and goes to 'view' a found item. I want to start a buch of threads but don't want them all to search for the same book. I do know all titles available but do not know how to make each thread search for a different one. I could try defining a varable per value and use __RandomFromMultipleVar() with all variables as its parameters but that would be quite a chunky piece of code if I wanted to select from more than just a few values. If there's a way of defining multivalue variables, it would realy come in handy.
Upvotes: 0
Views: 2137
Reputation: 46
You can add User defined Variables under Http Request with name and value Example: Name= option_1;option_2; option_3 and different Values for each option. User Defined Values Example
In Http request body add below code in place where you enter value.
"${__V(option_${__Random(1,3,)})}"
Upvotes: 2