In the process of scene monitoring, you want to know the running state of vusers when the scene is running and how many times each VUser virtual user is running in this scene, then you need to customize the display of Virtual user state information in the Vugen script.
The code is as follows:
Static intiteration; Action_userstatus () {//display parameter value in Vugen script, parameter alias is paramLr_output_message ("Current parameter:%s", Lr_eval_string ("{parameter}")); //A certain amount of thought time is set up, which correspondingly reduces the pressure on the load generator and slows down the system resources to avoid affecting the test results .Lr_think_time (4); //Displays the current parameter value and the number of current iterations in the Controller monitoring windowLr_vuser_status_message ("Current parameter:%s, iteration count:%d", Lr_eval_string ("{parameter}"),++iteration); return 0;}
After running the scene (Run interface), click VUser to open the view of the virtual user runtime, you can see each virtual user in the scene of the number of iterations, you can also calculate how many times the scene has been iterated (that is, how many times to run the script code in the action),
Observe how many iterations each virtual user tried, how many iterations were successful,
Through the above operation monitoring, we can draw a conclusion:
The "Run-time Settings" set in the controller scene overrides the "Run-time Settings" setting in the Vugen script, setting the number of iterations of the runtime in the controller scene, which is the "duration" set in the scene plan. "The number of iterations of a long-duration scene will be the same (PS: the corresponding TPS, throughput will increase).
LR Script custom Display controller virtual user state