When doing performance testing, we may encounter a variety of business requirements and user behavior, in a system or Web site, each user's operations are not exactly the same. How do we simulate the behavior of this user? Experience and ability is limited, I also do a simple analysis here.
Action Introduction
Before that, let's introduce an action, which is like a function package, where the user actions are stored in different functions according to the category, and when the HTTP protocol is selected, Vugen will automatically generate the script frame.
The default script directory is composed of three parts:
Vuser_int
Action
Vuser_end
In simple terms, we can think of them as three program files, which, in turn, are executed in the order of Vuser_int--->action--->vuser_end, and the scripts stored in the Action can be cycled (you can set the number of loops)
Before the script is recorded, we can set which part of the script to record:
In the script recording process, we can choose to switch the location of the script:
Right-click on the left side of the script to add a new action section:
In the menu bar vuser---> run-time setting, select the Run Logic option to set the number of loops in the action section.
The following is a brief introduction to performance testing using parameterization, action settings, and business user ratios.
Scene One:
A user access to Webtours (LoadRunner) home, do two times login and exit
1, Vuser_init partial recording visit Webrours homepage:
Vuser_init ()
{
Web_url ("Webtours",
"url=http://127.0.0.1:2080/webtours",
"resource=0
", " Reccontenttype=text/html ","
referer= ",
" Snapshot=t30.inf ",
" mode=html ", last
);
Web_url ("header.html",
"url=http://127.0.0.1:2080/webtours/header.html", "
resource=0",
" Reccontenttype=text/html ","
referer=http://127.0.0.1:2080/webtours/",
" Snapshot=t31.inf ","
Mode =html ", last
);
Web_url ("welcome.pl",
"Url=http://127.0.0.1:2080/webtours/welcome.pl?signoff=true", "
Resource=0",
"reccontenttype=text/html",
"referer=http://127.0.0.1:2080/webtours/", "
Snapshot=t32.inf",
"mode=html",
Extrares,
"url=." /favicon.ico "," referer= ", Enditem, last
);
}
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/extra/