Performance test concept point analysis and process explanation (iv)--grab Bag

Source: Internet
Author: User

2. How to grab the bag

1 Preparation matters

Install the grab kit and related browser plugins: Fiddler, Firefox firebug, etc. The installation process is no longer outlined here, check out the documentation I have written earlier, and familiarize yourself with how these tools are used.

LR Related settings: For handwriting scripts, the recording settings are not important, because it is not available, then the main need to set the running options, that is, run-time setting options in the relevant content, open VUser--->run-time setting

The Run logic setting generally directly selects the default, which means the number of times the action is executed at run time, and if the debug is intended to be repeated multiple times, you can adjust to the number of times you want.

pacing is to set the rhythm of the action loop, that is, the last cycle is completed immediately after the next cycle or a break. Looking at the business scenario requires that you can choose to perform the next loop immediately if it is not necessary.

Log Printing as mentioned above is as good as the above settings. The main is to adjust the trial. Or run the scene when the parametric data analysis of the scene.

think time to set think times. Think time refers to some of the steps and steps in our script execution time, such as login operation, obviously after the login page load is completed, to login to submit this process, the user needs a user name password input process, then these two parts of the request, there must be a pause time, And think time is to satisfy this scene to produce. In order to better and more accurately simulate user behavior. Set the think time, need to add in the script think Time function Lr_think_time (2), 2 is the time of the pause, the unit second. This function does not take effect if the think time selection is not set in the run settings after the function is added to the script. Of course, there will be a set of such settings in the scene, in order for this function to be checked to check the corresponding button on the line.

miscellanioeus Set automatic Transaction to collect response time and other test data for each thing. The main settings on these few, the other most of the default is good.

2.2 Grab Bag

Whether it is an interface request or a page request, we can find a way to catch it, using software such as Fiddler, you can clearly see a request and the response of the request. And our script is based on these packages. Specific methods of grasping the package are not discussed here. Check out the previously written fiddler use, here mainly to analyze the data of the packet capture and the corresponding relationship with the script.

First look at the headers of each request

You can see that headers contains some key information about the request, such as the request is get and the request address is http://wiki.intra.inzwc.com/rest/quickreload/latest/13468871?since= 1438235434617, the request message format is Application/json format, callback address Referer is http://wiki.intra.inzwc.com/pages/viewpage.action?pageId= 13468871, this information is the information required for subsequent script writing. Next look at the request parameters and body information.

This is a login request for me to invest, the request is the Post method, the specific parameters submitted include t=1438236210099 (timestamp), mobile=13012312314 (mobile phone number is the user name), loginpwd= Wbtc5wvj6eef7k8vqcc/9tpt5qhfnclzea/qd4mrbrzqpmywh8yanjvzeldwsoebgzuuyju/ ddmb09c5ulnhtbjlbbesv4whqfvjuniyi2iotuuxfqbean29wgfmq9nrye6rjsmxb2fguxrofhjjqiixpfmgfgj0av4mmphoe4c= (log in Password, The string that is generated after encryption), CHECKCODE=UHV6 (CAPTCHA). With this information combined with the information contained in the above headers, a commit request function can actually be written out.

web_submit_data("login", /** ----------函数名称---------**/

"Action=http://www.woqutz.com/uc/login/crossdomain-ajax-login?t=1438236210099", /***----请求的URL,对应抓包里面的URL----***/

"Method=POST", /**---提交请求的方式,一般就get或者post两种,其他方式比如update等很少用---***/

"RecContentType=text/html", /**--请求报文格式,一般也就那么几种,常见的text/html,application/json--**/

"Referer=http://jyzd.woqutz.com/", /**--回调地址对应headers中的referer--**/

"Snapshot=t34.inf", /**-LR中的快照,手写脚本这个可以随机写一个,不过txx.inf 这种格式需要保持-**/

"Mode=HTTP", /**--请求准守的http请求协议,这个一般的B/S结果程序都是一样的--**/

ITEMDATA, /**-脚本函数中的关键字,上面是对请求头的一些定义,下面则是对body相关的一些定义。-**/

"Name=t", "Value= 1438236210099", ENDITEM,

"Name= mobile", "Value= 13012312314", ENDITEM,

"Name= loginPwd", "Value=wbTC5wVj6eef7k8VQcc/9TpT5QhFnclzeA/QD4mrbrZqpMyWH8YanJvzEldWSOEBGZuUyju/Ddmb09C5uLnHTBjlbBesv4WHqfVJuNIyi2ioTUuXfqbeAN29WgFMq9NRYe6RJsMxb2fGUxrOFHJjqIIxpfmgFGJ0Av4MmPhoE4c=", ENDITEM,

"Name= checkCode", "Value= uhv6", ENDITEM,LAST);

Such a commit function is completed, in fact, the general request, LR recorded the script well, the key function is just a few, one is the commit function, another common is another request function:

Web_custom_request ("Jyzdgateway.aicai.com/gataway",
"Url=http://jyzdgateway.aicai.com/gataway/req?service_name=ec_freeze_balance&partner_id=10001&sign= f745fae2c597ce28b682fd120d76b75e&sign_type=md5&request_time=20150725120026&out_freeze_no=dj{ Newparam}&freeze_amount=10&identity_id={newparam_1}&account_type=member&summary=haha TEST Summary&ext1=ext11&ext2=ext2222&ip=192.168.1.1&_input_charset=utf-8 ",
"Method=get",
"Resource=1",
"Referer=",
"Snapshot=t2.inf",
"Enctype=",
last);

Note the two function format, a little bit different, the Web_submit_data function will generally have parameter submissions, and parameters will be listed separately, and the Web_custom_request function is also a parameter submission, but the parameters are directly included in the request address. The above example is an interface request that funds a project account amount to freeze. The whole url=http://jyzdgateway.aicai.com/gataway/req?service_name=ec_freeze_balance&partner_id=10001&sign= f745fae2c597ce28b682fd120d76b75e&sign_type=md5&request_time=20150725120026&out_freeze_no=dj{ Newparam}&freeze_amount=10&identity_id={newparam_1}&account_type=member&summary=haha TEST Summary&ext1=ext11&ext2=ext2222&ip=192.168.1.1&_input_charset=utf-8 in front of the jyzdgateway.aicai.com/ Gataway/req is the real request address, and? The following are all submitted parameters, Service_name=xxx, separated by & symbol additional parameters, partner_id=10001 (merchant ID), SIGN=XXXXXXXX (security verification signature), Sign_type=md5 (signature method) Request_time=2015xxxxx (Request time), OUT_FREEZE_NO=XXXXXXX (Request order number), freeze_amout=10 (frozen amount), identity_id=xxxxxx (user ID), Account_type=member (the type of freezing user), the parameters after Summary=xxxx is only for the convenience of logging and monitoring and incoming, and the actual business relationship is small.

There are two commit functions listed here, with examples of two request methods to select the Commit function and how to convert the request to the LR code. The main thing is to understand what the captured data is, what to do with it, and what information each of the LR submission functions is filled in so that, in the case of any conversion request, it can be converted to the LR performance script we want based on the data captured by the packet.

Here are just two requests, of course, the real business stress test logic may be more than a packet capture data, may contain a lot of requests, this time we need to write and in order.

Reprint to: http://mp.weixin.qq.com/s?__biz=MjM5OTI2MTQ3OA==&mid=210237657&idx=1&sn= b72e2f576a2f41052c734dd6ee8f8dab&scene=0&key= Dffc561732c22651b6583331c941efe169d2b542b1a572d05d9f4892c40ee31842030dd5f59aa5570385fc78b7bde4af&ascene=1 &uin=mji2njmxmjuymw%3d%3d&devicetype=windows+7&version=6102002a&pass_ticket=ianfcji5nai8zaj% 2bqcw1%2bqnvnqqn9kclq98itkycagbhkbjamfnnvc23cpkwntj6

Performance test concept point analysis and process explanation (iv)--grab Bag

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.