I would like to test an app with random variable logic through JMeter. it is voting application.
Flow: Login-voting-ReVoting-Logout for 250 users
Problem: I have to vote 1 person out of 3 members and again I have to re-vote to another person. I have defined vote members id in user defined variables,so first I have used bean shell code for the first vote. here is the code.(Beanshell1)
import java.util.Random;
String[] categories = (vars.get("categories")).split(",");
int idx = new Random().nextInt(categories.length);
String category = (categories[idx]);
vars.put("rnd_cat",category);
for re-voting, I want to exclude the previous vote member id, so I have used below code for that (Beanshell2)
while(category==rnd_cat)
{
String[] categories = (vars.get("categories")).split(",");
int idx2 = new Random().nextInt(categories.length);
category = (categories[idx2]);
}
but I am getting void in the response.
Aucun commentaire:
Enregistrer un commentaire