Home > database >  Is there a way to set up number of users for different thread in JMeter 5.3?
Is there a way to set up number of users for different thread in JMeter 5.3?

Time:04-19

I am currently working on testing small API in our company and I need to randomly distribute a number of calls on all methods of that API. I am using 5.3 version of JMeter, company security politics, so we do not have newer versions if that matters.

Because number of methods is around 15 my idea right now is supply .properties file to JMeter, which will contain overall number of calls to API, then, through JSR223 sampler in SetUp Thread Group I will set properties with random amount of users in thread. However, I encountered a problem in doing so: I successfully set all properties, but I cannot access them, when calling ___property function in another Thread groups.

Is there any method to set those properties by script and access them through JMeter function?

Edit: Adding the code I am using in SetUp Thread Group to add properties

jmeter_properties.load(new FileInputStream(new File('env.properties')));
def allUsers = jmeter_properties.get('number.of.users') as Integer;
def random = new Random();
def thisUsers = random.nextInt(allUsers);
allUsers = allUsers - thisUsers;

props.put('getProjectById.users', thisUsers);```

CodePudding user response:

I'm not sure whether it's expected behaviour or a bug in JMeter which should be reported via enter image description here

  • Related