Verifying LoadRunner's checksum of Ajax content

Source: Internet
Author: User

To test the performance of a system with a team of colleagues. This system is a service that sends Ajax requests to the background and then calls a third party. The performance of third-party services is not up to our control, so developers have made improvements, and timeouts are returned directly. So on the LoadRunner side, the result is much more beautiful. At that time I did not care, and then a pondering, this is not to say LoadRunner do not check Ajax content on the passage? To validate this assertion, a simple example is made.
The first is to write a front-end HTML, send Ajax to the background, and then write a servlet processing requests, return different content. The script is then recorded and played back with LoadRunner to verify the status of the Ajax content.
Create a new Web project, add an HTML file and a servlet

The HTML content is as follows:

This is a simple simulation of registering the page, Ajax sends the input username into the background.

The servlet handles the code as follows:

protected void dopost (httpservletrequest request,  Httpservletresponse response)  throws servletexception, ioexception {// todo  auto-generated method stubtry {thread.sleep (500);}  catch  (interruptedexception e)  {// TODO Auto-generated catch  Blocke.printstacktrace ();} String username = request.getparameter ("username"); Printwriter out=response.getwriter (), if (Username.equals ("Zhangsan")) {Out.print ("existed");} Else{out.print ("registered successfully");}} 

When the input user is Zhangsan, AJAX returns a flag that the user name already exists, and in addition returns a hint that can be registered. (To simulate network delay, pause 500 milliseconds)

LoadRunner recorded the following script:

Action () {web_reg_find ("text= user Registration", last)     web_url ("AAA",  "url=http:// 192.168.1.102:8080/aaa/", " resource=0 ", " reccontenttype=text/html ", " Referer= ", " Snapshot= T1.inf ", " mode=html ",  last)//web_reg_find (" text=existed ", last); Web_custom_request (" CheckName ",   "Url=http://192.168.1.102:8080/aaa/checkname?username=zhangsan",  "Method=post",  "Resource=0",   "referer=http://192.168.1.102:8080/aaa/",  "Snapshot=t2.inf",  "mode=html",  "EncType=",  last)//web_reg_find ("text=registered successfully", last) web_custom_request ("CheckName_2",  " Url=http://192.168.1.102:8080/aaa/checkname?username=lisi ", " Method=post ", " Resource=0 ", " referer=http://192.168.1.102:8080/aaa/", " Snapshot=t3.inf ", " mode=html ", " EncType= ",  LAST) ; Web_submit_data ("Checkname_3",  "Action=http://192.168.1.102:8080/aaa/checkname",  "Method=POST",   "Referer=http://192.168.1.102:8080/aaa/", " Snapshot=t4.inf ", " mode=html ", itemdata, " Name=username ", " Value=lisi ",  enditem,  "Name=password",  "value=123456",  enditem, last); return 0;}

The two lines in the note are manually added, and the content returned by Ajax can be detected.

This article is from the "Empty" blog, make sure to keep this source http://6738767.blog.51cto.com/6728767/1591892

Verifying LoadRunner's checksum of Ajax content

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.