質問

Currently i'm working on load splitting scenario in jmeter.
My test-plan structure is similar as below:


TestPlan
BeanShell Preprocessor (here I have below code)

    Integer totalLoad = 0;
    Integer searchUsers = 0;
    Integer createUseres = 0; 

    totalLoad = Integer.parseInt (vars.get("TOTALUSERS")); 
    searchUsers = ((totalLoad / 100) * 40);  createUseres =((totalLoad / 100) * 10);  guestUsers = ((totalLoad / 100) * 50);

    vars.put("searchUsers", searchUsers.toString());
    vars.put("createUseres", createUseres.toString());
    vars.put("guestUsers", guestUsers.toString()); 

Thread group: Search (I am using ${searchUsers} in the number of Threads(users) field) 
Thread group: Create (I am using ${createUseres} in the number of Threads(users) field) 
Thread group: Guest (I am using ${guestUsers} in the number of Threads(users) field) 

This is not working for me.
Can you please help?

役に立ちましたか?

解決

JMeter variables are local to each thread. So if you'll create those variables in preprocessor, they won't be accessible to other threads at this level.

You should use properties to put/get searchUsers, createUseres, guestUsers like:

Use props.put("guestUsers", guestUsers.toString()); in BeanShell Preprocessor. Use ${__P(searchUsers)} as number of threads in Thread Group.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top