LoadRunner Testing the AJAX framework

Source: Internet
Author: User

LoadRunner test The AJAX framework of the system, recording playback is not an error, but after the playback system does not produce data, the solution

Loadrunnerajax Framework Test Script Headerajax

"Problem description" when testing the AJAX framework system with LoadRunner, there was no error in recording playback, but no data was generated in the system after playback, and data was never written to the database. Check the reason, should be the recording of the script is imperfect, because JS is a program executed on the client, LR can only monitor the client and the server before the communication.

"Workaround": Recording options> HTTP properites> advanced > Headers: Select "Record Headers not in List" and click OK. Re-record the script, you will find some web_add_auto_header in the script, Web_add_header function. These functions are related to Ajax, added to the original script, re-playback, problem solving.

Verifying LoadRunner's checksum of Ajax content

Loadrunner11 on web Ajax testing

Business process: User Login-Search for Books-book book
Login input username and password, search input book name click Button Search, book search results click the request button on the back of the book, go to the request page, fill in the date related information click Submit.
When you start planning, it feels like the script is the best to record, so put the plan behind it, but you have a problem with the actual operation.
1. In the book this transaction, there are two submissions, the first time is to submit the contents of the book to the form, the second time to submit the booking date and other information. However, in the two submissions, no information about the book could be found, and the book transaction could not be parameterized.
Workaround:
Try 1: parameterize all fields in the script that appear in the book name, two parameters run two times, first success, second failure
Try 2: Search only a single book, only parametric search transactions, two parameters run two times, the first success, the second failure
Try 3: Set Loadrunner-record option-http property-advanced-header-record Header not in list. Re-recording, found that the script more than a lot of web_add_auto_header,web_revert_auto_header functions, search only a single book search, only parametric search transactions, two parameters run two times, the first success, the second failure
Try 4: Protocol Select Ajax, set Loadrunner-record option-http property-advanced-header-record Header not in list. Set the parameter two times to run two times, both successfully.

The Ajax subscription script is as follows:
Search one book and request this book
Lr_start_transaction ("search");
Lr_think_time (24);
Input book name
Web_edit_field ("Query",
"Snapshot=t4.inf",
DESCRIPTION,
"Type=text",
"Name=query",
ACTION,
"Setvalue={title}",
last);
If on search result,this text would display
Web_reg_find ("Text=no results were found for your search request",
"Savecount=count2",
last);
Click Search button
Web_button ("Input_2",
"Snapshot=t5.inf",
DESCRIPTION,
"Type=submit",
"Tag=input",
"Id=search_submit",
ACTION,
"Useraction=click",
last);

if (Atoi (lr_eval_string ("{count2}")) ==0)
{
Lr_end_transaction ("Search", Lr_pass);
Lr_output_message ("Search Suss,because%d", Atoi (Lr_eval_string ("{count2}"));
Lr_output_message ("Search title is%s", Lr_eval_string ("{title}"));
}
Else
{
Lr_end_transaction ("Search", lr_fail);
Lr_error_message ("Search Fail,because%d", Atoi (Lr_eval_string ("{count2}"));
}



Starting request Transaction
Lr_start_transaction ("request");
Lr_think_time (10);
Web_check_box ("ListItems",
"Snapshot=t6.inf",
DESCRIPTION,
"Name=listitems",
ACTION,
"Set=on",
last);
Click the Request button
Web_text_link ("Request",
"Snapshot=t7.inf",
DESCRIPTION,
"Text=request",
ACTION,
"Useraction=click",
last);

Lr_think_time (13);

Web_list ("Mainlocationfilter",
"Snapshot=t8.inf",
DESCRIPTION,
"Name=mainlocationfilter",
ACTION,
"Select=hong Kong Central (*1000000)",
last);

Lr_think_time (5);

Web_edit_field ("ExpirationDate",
"Snapshot=t9.inf",
DESCRIPTION,
"Type=text",
"Name=expirationdate",
ACTION,
"Setvalue=2011/08/08",
last);

Web_reg_find ("text=transaction Reference number",
"Savecount=count3",
last);

Web_reg_find ("Text=your request has been submitted",
"Savecount=count4",
last);

Web_button ("Input_3",
"Snapshot=t10.inf",
DESCRIPTION,
"Type=submit",
"Tag=input",
"Id=id52",
ACTION,
"Useraction=click",
last);

if (Atoi (lr_eval_string ("{count3}")) ==1&&atoi (Lr_eval_string ("{count4}")) ==1)
{
Lr_end_transaction ("Request", Lr_pass);
Lr_output_message ("Request Suss,because%d", Atoi (Lr_eval_string ("{count3}"));
}
Else
{
Lr_end_transaction ("Request", lr_fail);
Lr_error_message ("Request Fail,because%d", Atoi (Lr_eval_string ("{count4}"));
}

LoadRunner Testing the AJAX framework

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.