Correlation, parameterization, think time, checkpoints, and how transactions are set up

Source: Internet
Author: User

Action ()
{

If the associated data is too long, you need to make the value of the parameter store larger here
Web_set_max_html_param_len ("1024");

The correlation function is to get the value by specifying the left and right boundaries. If the load first page is placed in front of the vuser_init or correlation function, execution will error,
Error-26377: The match for the requested parameter "Usersessionlogin" could not be found. Please check the response data for the requested bounds
WEB_REG_SAVE_PARAM_EX (
"Paramname=correlationparameter_1",//name of the association, customizable
"Lb=usersession value=",//left border
"Rb=>\n<table border",//Right border
Search_filters,
"Scope=all",
"Ignoreredirections=yes",
"Requesturl=*/nav.pl*",
last);


First page load insert transaction, check response time
Lr_start_transaction ("The_first_page_load");
Home Page load


Web_url ("Webtours",
"Url=http://127.0.0.1:1080/webtours/",
"Targetframe=",
"Resource=0",
"Reccontenttype=text/html",
"Referer=",
"Snapshot=t2.inf",
"Mode=html",
last);

Lr_end_transaction ("The_first_page_load", Lr_auto);

Lr_think_time (3); Think time set 3 seconds, if need to start, need to run_time settings>general>think times to remove the tick ignore think time setting


Checkpoint settings, check if the Login Success page has a user name displayed, and if so, the transaction executes successfully


Web_reg_find ("Search=all",
"Savecount=savecountfail",
"Text=web Tours error-incorrect Password",
last);

Login Services
Lr_start_transaction ("login");

Login page, enter your account number and password

/* Request with GET method to URL "Http://127.0.0.1:1080/favicon.ico" failed during recording. Server response:404*/

/* Request with GET method to URL "Http://bho.xl7.xunlei.com/platform/2.6.x.xxxx/config.xml" failed during recording. Server response:404*/

Lr_think_time (12);

Web_submit_data ("login.pl",
"Action=http://127.0.0.1:1080/webtours/login.pl",
"Method=post",
"Targetframe=body",
"Reccontenttype=text/html",
"Referer=http://127.0.0.1:1080/webtours/nav.pl?in=home",
"Snapshot=t3.inf",
"Mode=html",
ItemData,
"Name=usersession", "value={correlationparameter_1}", Enditem,
"Name=username", "Value={username}", Enditem,
"Name=password", "Value={password}", Enditem,
"Name=jsformsubmit", "Value=off", Enditem,
"Name=login.x", "value=70", Enditem,
"Name=login.y", "value=20", Enditem,
last);

Lr_output_message ("string associated with output:%s", lr_eval_string ("{correlationparameter_1}"));

If the parameterized password is wrong, there is a problem with the judgment, the password is wrong, web_reg_find to find the username parameterization, Savecountfail should return 0, but the return is 2, and enter the correct user name and password instead savecountfail becomes 0, this problem to be resolved
The solution to the above problem is the reverse operation, web_reg_find find Web Tours error-incorrect Password, if found, then login failed, if not found, then the successful landing, can solve the above problem
To determine if a transaction is performing successfully
if (Atoi (lr_eval_string ("{savecountfail}"))!=0)
{
Lr_end_transaction ("Login", lr_fail);
Lr_log_message ("Find the number:%s", Lr_eval_string ("{savecountfail}"));
Lr_log_message ("Login fail,username:%s", lr_eval_string ("{username}"));
Lr_log_message ("Login fail,password:%s", lr_eval_string ("{password}"));

}


Else

{

Lr_end_transaction ("Login", Lr_pass);
Lr_log_message ("Find the number:%s", Lr_eval_string ("{savecountfail}"));
Lr_output_message ("Success");
Output User name and password
Lr_log_message ("The correct username:%s", lr_eval_string ("{username}"));
Lr_log_message ("The correct password:%s", lr_eval_string ("{password}"));
}


Lr_think_time (3);

Lr_start_transaction ("Loginout");

Lr_think_time (21);

Web_url ("Signoff button",
"Url=http://127.0.0.1:1080/webtours/welcome.pl?signoff=1",
"Targetframe=body",
"Resource=0",
"Reccontenttype=text/html",
"Referer=http://127.0.0.1:1080/webtours/nav.pl?page=menu&in=home",
"Snapshot=t4.inf",
"Mode=html",
last);

Lr_end_transaction ("Loginout", Lr_auto);

return 0;
}

Correlation, parameterization, think time, checkpoints, and how transactions are set up

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.