`

web test LoadRunner xml / webservice / json / MQ / baowen / WebService / ESB

 
阅读更多

 

s

 

loadrunner 学习笔记--Web Services

http://www.byywee.com/page/M0/S227/227297.html

使用loadrunner测试Web Services的程序

http://blog.sina.com.cn/s/blog_7833c84501010e9d.html

首页>> 文章精选>> 测试丛书>> 性能测试进阶指南——LoadRunner 11实战>> 查看资讯

性能测试进阶指南—LoadRunner 11实战(20) 发布时间: 2012-6-11 10:42 作者: 陈霁

http://www.51testing.com/html/42/n-815142.html

Loadrunner上传文件解决办法(大文件)

http://www.chinatesting.cn/212/12929212.shtml

 

Loadrunner 录制WebService协议测试脚本的两种方式 / WebService协议Loadrunner脚本录制的两种方式.doc

http://dl.iteye.com/topics/download/be0e0edc-f634-3fbf-8faa-bc4ea7c88ef3

文档背景:

信息体系各系统开发时会和多个系统交互,而交互过程中不可避免的会用到接口,而web service技术无疑提供了一种很好的方式,对于使用web service协议的接口如何进行测试以及测试脚本如何准备,这边基于现有条件,讲解web service协议的接口测试脚本准备的两种方式。

正文:

第一种方式:步骤一:需项目组事先提供报文、接口的入口URL以及接口正确调用时的响应。打开loadrunner11,新建单协议脚本,选择webservice协议,如下图1所示

http://dl2.iteye.com/upload/attachment/0096/6602/ecc50a4c-9453-3df8-b1d9-8e1c46bb3c30.png

 

loadrunner导入soap服务

http://dl2.iteye.com/upload/attachment/0096/6607/203c2add-3e39-305d-930b-729554a36073.png

loadrunner导入soap服务项目组自定义XML文件

http://dl2.iteye.com/upload/attachment/0096/6611/223dd64d-0f17-342d-b4ef-5d8ef527a4db.png

步骤三:打开报文后,点击图三中的Load按钮,点击后如图四所示,在URL栏中,输入接口的地址,再在soap action中输入该接口的操作名称,可任意填写,但是最好是和接口所代表的意思一致,便于识别。这边用的例子为:

loadrunner导入soap_url和soap_saction业务名称

http://dl2.iteye.com/upload/attachment/0096/6619/0a857876-8fe3-3818-87d6-e3a49993fdb6.jpg

 

步骤四:点击OK,添加事务以及相应检查点和参数化。即可生成脚本。

http://dl2.iteye.com/upload/attachment/0096/6626/05c651c8-da91-3336-979d-1607224582ea.png

   

   // 最好加上如下xml描述文件

   web_add_header("Content-Type","application/xml");

   // 最好加上如上xml描述文件

  

步骤五:脚本生成后,可以运行下,看脚本的相应是否和项目组提供的一致,如果一致的话,说明脚本正确,不一致的话,需要调试,至于如何调试,在此不一一赘述。唯一的条件是如果项目组提供的xml报文中的参数有中文,在转化成脚本后会成为乱码,最好采用数据或者字母,如果必须是中文的话,需要做转码处理。

===================================================================================

第二种方式:以pos价格服务的脚本准备为例

步骤一:打开loadrunner11,新建单协议脚本,选择webservice协议,如下图1所示

http://dl2.iteye.com/upload/attachment/0096/6602/ecc50a4c-9453-3df8-b1d9-8e1c46bb3c30.png

 

步骤二:步骤一完成后,出现如下界面,如图二,点击Add Service Call如图三所示,在图三中的Service处选择Import Service,选择URL(注:开发人员提供的URL “http://192.168.100.125:8180/ws/AccessWS.jws?wsdl”),点击Import 生成如图四:

http://dl2.iteye.com/upload/attachment/0096/6639/a68c3819-c3ae-3167-b3c9-5d77633f0259.png

http://dl2.iteye.com/upload/attachment/0096/6641/08aa2f52-a657-3364-9eb1-3eff11e2d2e6.png

点击id字段,选择value输入值,按照这种方法依次将pwd、fn、args字段赋值。如图五

http://dl2.iteye.com/upload/attachment/0096/6644/71d3e501-93bf-3c7c-8d9a-3520139f175a.png

 

最后在Output Arguments的processResult处勾选Save returned value in para,如图六,该步骤是为将返回参数打印出来,以此来验证数据的正确性。然后点击OK,如图七:

http://dl2.iteye.com/upload/attachment/0096/6646/7bc5917f-eb12-3400-9ffe-c9c92203a28e.png

 

添加事务和参数输出后即可:

http://dl2.iteye.com/upload/attachment/0096/6649/8d837b78-6693-39cd-9922-0c12c929f4b7.png

总结

第一种方式和第二种方式各有各的使用优点和局限性,第一种方式,需要项目组提供报文,以及接口访问的url还有报文的响应。

第二种方式,需要了解输入输出参数的名字和类型。如果一个wsdl文件中包含多个接口以及接口和接口之间有关联性的话,脚本准备起来有一定的复杂性。

不过各种方式都要基于项目组所配合的程度以及提供数据的方式,如果提供第一种方便就用第一种,如果第二种方便就用第二种。

 

loadrunner post / loadrunner 三种post请求 

http://www.51testing.com/html/85/132585-1467147.html

Loadrunner三种post格式的请求

1 web_custom_request

intweb_custom_request(const char *RequestName, <List of Attributes>,

[EXTRARES, <List of Resource Attributes>,] LAST ); 

第一种:自定义http格式的请求,可以是任何的方式或是body如下:

web_custom_request("xxxxx",

                            "URL=http://xxxx.xxxx.xxx",

                            "Method=POST",

                            "Resource=0",

                            "Snapshot=t10.inf",

                            "Mode=HTML",

                            "EncType=application/x-www-form-urlencoded",

                            "Body={\"sign\": \"{sign}\",\"token\": \"68C116cd449034db04C8ff2B7271B345\",\"time\": \"123456\",\"params\": {\"city_id\": \"2419\",\"advert_id\": \"2139\",\"offset\": \"0\",\"pagesize\": \"10\"}}",LAST);

 

2 web_submit_data 

intweb_submit_data(const char *StepName, const char *Action,<List of Attributes>, ITEMDATA, <List of data>, [ EXTRARES, <List of Resource Attributes>,] LAST ); 

第二种提交:支持post和get请求. 

web_submit_data("pay_check.php",

         "Action=http://buyinterface.{url}/v1/pay_check.php",

                            "Method=POST",

                            "RecContentType=text/html",

                            "Snapshot=t7.inf",

                            "Mode=HTML",

                            ITEMDATA,

                            "Name=my_id", "Value={myid}", ENDITEM,

                            "Name=trade_no", "Value={trano_1}", ENDITEM,      

                            LAST);

3 web_submit_form.

intweb_submit_form(const char *StepName, <List of Attributes>, <List of Hidden Fields>, ITEMDATA, <List of Data Fields>, [ EXTRARES, <List of Resource Attributes>,] LAST );

第三种:只支持post请求

web_submit_form("db2net.exe",

    ITEMDATA,

    "name=library.TITLE", "value=Practical UNIX Security", ENDITEM,

    "name=library.AUTHOR_S_", "value=Garfinkel", ENDITEM,

    "name=library.SUBJECTS", "value=", ENDITEM,

    LAST );

 遇到不知道怎么办时,最好问下开发,支持什么格式.

 

 

loadrunner baowen / 报文 / 接口报文 

loadrunner--中台商品寻源接口报文样例

D:\TestCase\20140604_zhongtai_xunyuan\TC_SSDS_PageSource\TC_SSDS_PageSource.usr

Action()
{
   
	lr_start_transaction("pageSource");

	web_reg_find("Fail=NotFound",
		"Search=All",
		"SaveCount=pageCount",
		"Text=<Status>COMPLETE</Status>",
		LAST);
    web_custom_request("PageSource",
		"URL=http://ssdspre.cns*****.com/ssds-web/onLinePageSource.htm",
        //RL=http://10.27.39.75:9080/ssds-web/onLinePageSource.htm",
       // "URL=http://10.27.39.69:9080/ssds-web/onLinePageSource.htm",
       // "URL=http://10.27.39.56:9080/ssds-web/onLinePageSource.htm",
       // "URL=http://10.27.39.55:9080/ssds-web/onLinePageSource.htm",
		"Method=POST",
		"Mode=HTTP",
		"EncType=text/xml; charset=GB2312",
		"Body=<?xml version=\"1.0\" encoding=\"utf-8\"?>"
		"<MbfService>"
		"<input1>"
		"<MbfHeader>"
		"<ServiceCode>SearchSourceMgmt</ServiceCode>"
		"<Operation>queryOnlinePageSource</Operation>"
		"<AppCode>B2C</AppCode><UId>20140520131415161234567890123456</UId><AuthId>B2C;iEIKQ1lqBnW$</AuthId></MbfHeader>"
		"<MbfBody>"
		    "<onLinePageSourceReq>"
		    "<cmmdtyCode>{cmmdtyCode}</cmmdtyCode>"
		    "<cityCode>{cityCode}</cityCode>"
		    "<districtCode>{districtCode}</districtCode>"
		    "<supplierCode/>"
		    "<searchType>01</searchType>"
		    "</onLinePageSourceReq>"
		"</MbfBody>"
		"</input1>"
		"</MbfService>",LAST);
	if((atoi(lr_eval_string("{pageCount}"))<1))               
	{	
		 lr_end_transaction("pageSource",LR_FAIL);  
	}
	else
	{	
         lr_end_transaction("pageSource",LR_PASS);
	}
	return 0;
}

 

(参数文件数据要求:一一对应)

 D:\TestCase\20140604_zhongtai_xunyuan\TC_SSDS_PageSource\pageSource.dat

 

cmmdtyCode,cityCode,districtCode
000000000103929805,000001000186,70103
000000000101063403,000001000016,56503
000000000100005503,000001000048,75205
000000000100005503,000001000051,75506
000000000100005503,000001000057,76206
000000000100042403,000001000096,79905
000000000100042403,000001000097,31317
000000000100042403,000001000098,31411
000000000100042403,000001000100,31610
000000000100042403,000001000000,01020
000000000100081803,000001000154,73412
000000000100081803,000001000155,73511
000000000100081803,000001000159,73912
000000000100081803,000001000163,74611
000000000100092203,000001000199,41111
000000000100154503,000001000333,02340
000000000100154503,000001000273,81807
000000000100165503,000001000151,73109
000000000100165503,000001000161,74404
000000000100171503,000001000139,71310

 

Loadrunner WebService Exception 

问题1:

SOAP request failed due to incorrect SOAP format

Loadrunner Replay log:

Action.c(14): Error: The reason for the SOAP fault is: "com.s*****.framework.dal.exception.DalException incompatible with com.s×××××.framework.workflow.exception.WorkflowException"

Action.c(14): Error: SOAP request "SOAP Request" execution failed

Loadrunner Test Result: 

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
	<soap:Body>
		<soap:Fault>
			<faultcode>soap:Server</faultcode>
			<faultstring>com.s*****.framework.dal.exception.DalException. incompatible with 
				com.s*****.framework.exception.WorkflowException</faultstring>
		</soap:Fault>		
	<soap:Body>	
</soap:Envelope>	

Loadrunner Replay log: 

Virtual User Script started at : 2014-05-12 15:49:57

Starting action vuser_init.

Ending action vuser_init.

Running Vuser...

Starting iteration 1.

Starting action Action.

Action.c(7): SOAP request "SOAP Request" started

Action.c(7): Warning: HTTP status code 500 returned by the server

Action.c(7): Error: The reason for the SOAP fault is:"Error reading XMLStreamReader."

Action.c(7): Error: SOAP request "SOAP Request" execution failed

Ending action Action.

Ending iteration 1.

Ending Vuser...

Starting action vuser_end.

Ending action vuser_end.

Vuser Terminated.

 

Loadrunner Replay log: 

Virtual User Script started at : 2014-05-12 16:24:41

Starting action vuser_init.

Ending action vuser_init.

Running Vuser...

Starting iteration 1.

Starting action Action.

Action.c(7): SOAP request "SOAP Request" started

Action.c(7): Warning: HTTP status code 500 returned by the server

Action.c(7): Error: The reason for the SOAP fault is:"Error parsing document.. Nested exception is com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 start byte 0xbb (at char #1601, byte #1120)"

Action.c(7): Error: SOAP request "SOAP Request" execution failed

Ending action Action.

Ending iteration 1.

Ending Vuser...

Starting action vuser_end.

Ending action vuser_end.

Vuser Terminated.

 

 

解决:

Tip: To better understand the cause of failed steps, you can record movie clips of run sessions and view them together with the step result details.

在loadrunner测试脚本里加入如下定义描述即可。

   web_add_header("Content-Type","application/xml");

 

问题2: 

Loadrunner Scenario run-time setting 。

loadrunner 场景设置注意事项,当模拟多用户压测时,压测突然停止。

解决:

http://dl2.iteye.com/upload/attachment/0096/8181/24fdaa6c-1d15-35c3-a076-91b3b24f2871.png

D:\TestCase\20140428_OA_workflow_db2_update\tc_workflow_start22

 

问题3: 

Loadrunner Parameter loadrunner参数化设置问题,当取值唯一性unique number的参数设置注意事项

解决:

http://dl2.iteye.com/upload/attachment/0096/8183/5071c30a-9559-361b-bf42-272bd22eff04.png

D:\TestCase\20140428_OA_workflow_db2_update\tc_workflow_start22

 

问题4

http://dl2.iteye.com/upload/attachment/0097/0736/36fc4286-e2e9-3554-aec2-f39224e29c93.png

Virtual User Script started at : 2014-05-13 14:54:30

Starting action vuser_init.

Web Services replay version 11.0.0 for WIN2003; Toolkit: "NotDefined"; build 8859

Run-Time Settings file: "D:\TestCase\20140428_OA_workflow_db2_update\tc_workflow_getAvailablePaths\\default.cfg"

Vuser directory: "D:\TestCase\20140428_OA_workflow_db2_update\tc_workflow_getAvailablePaths"

Vuser output directory: "D:\TestCase\20140428_OA_workflow_db2_update\tc_workflow_getAvailablePaths\"

LOCAL start date/time:  2014-05-13 14:54:30

Ending action vuser_init.

Running Vuser...

Starting iteration 1.

Starting action Action.

Action.c(10): Registering web_reg_find was successful  [MsgId: MMSG-26390]

Action.c(16): Notify: Transaction "getAvailablePaths" started.

Action.c(17): SOAP request "SOAP Request" started

Action.c(17): t=417ms: 150-byte response headers for "http://10.19.218.179/snf-workflow-web/webservice/EngineService?wsdl" (RelFrameId=1, Internal ID=1)

Action.c(17):     HTTP/1.1 400 Bad Request\r\n

Action.c(17):     Date: Tue, 13 May 2014 06:54:04 GMT\r\n

Action.c(17):     Content-Length: 226\r\n

Action.c(17):     Connection: close\r\n

Action.c(17):     Content-Type: text/html; charset=iso-8859-1\r\n

Action.c(17):     \r\n

Action.c(17): t=431ms: 226-byte response body for "http://10.19.218.179/snf-workflow-web/webservice/EngineService?wsdl" (RelFrameId=1, Internal ID=1)

Action.c(17):     <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n

Action.c(17):     <html><head>\n

Action.c(17):     <title>400 Bad Request</title>\n

Action.c(17):     </head><body>\n

Action.c(17):     <h1>Bad Request</h1>\n

Action.c(17):     <p>Your browser sent a request that this server could not understand.<br />\n

Action.c(17):     </p>\n

Action.c(17):     </body></html>\n

Action.c(17): Error: HTTP status code 400 returned by the server

Action.c(17): Error: SOAP request "SOAP Request" execution failed

Action.c(17): Notify: Transaction "getAvailablePaths" ended with "Fail" status (Duration: 0.1939 Wasted Time: 0.1633).

Ending action Action.

Ending iteration 1.

Ending Vuser...

Starting action vuser_end.

Ending action vuser_end.

Vuser Terminated.

解决:

   //web_add_header("Content-Type","application/xml");

//web_add_header("EncType=text/xml","charset=UTF-8");

 

//"EncType=text/xml; charset=GB2312",

 

web_reg_find("Fail=NotFound",

"Search=All",

"SaveCount=placeflag",

"Text/IC=COMPLETE",

LAST);

 

   lr_start_transaction("getAvailablePaths");

soap_request("StepName=SOAP Request",

"URL=http://10.19.218.179/snf-workflow-web/webservice/EngineService?wsdl",

"SOAPEnvelope="

        //"<?xml version=\"1.0\" encoding=\"GB2312\" ?>"   //这里加上XML编码即可把中文乱码数据传递失败解决

、、、

 

 

 

初步调试:WAS 版本 7.0.0.13

单压测WAS1 机器,loadrunner性能平稳,TPS 300笔/秒 ,响应时间 0.057秒

单压测WAS2 机器,拷贝WAS1应用代码包到WAS2loadrunner性能异常,TPS 100笔/秒(一直下降) ,响应时间 0.057秒(一直上升),停止压测后,应用实例java进程一直占用内存不释放。

查找异常:

应用实例wf_srv2 SystemOut.log

[loguser@wfpreapp2~]$ tail -f/opt/IBM/WebSphere/AppServer/profiles/check/logs/wf_srv2/SystemOut.logSystemOut.log 无异常打印,

[loguser@wfpreapp2 ~]$ more wf_srv2_exception.log

 

 

 Index  Count  Time of first Occurrence    Time of last Occurrence     Exception SourceId ProbeId

------+------+---------------------------+---------------------------+---------------------------

     0      3     5/8/14 18:07:14:505 CST     5/8/14 18:07:15:404 CST com.ibm.websphere.management.exception.ConnectorException com.ibm.ws.man

agement.RoutingTable.Accessor.getConnector 583 /opt/IBM/WebSphere/AppServer/profiles/check/logs/ffdc/wf_srv2_4d984d98_14.05.08_18.07.14.521561

1502752903065554.txt

     1      3     5/8/14 18:07:14:609 CST     5/8/14 18:07:15:404 CST com.ibm.websphere.management.exception.ConnectorNotAvailableException co

m.ibm.ws.management.RoutingTable.Accessor.getConnector 610 /opt/IBM/WebSphere/AppServer/profiles/check/logs/ffdc/wf_srv2_4d984d98_14.05.08_18.

07.14.6097402533075760915140.txt

     2      1     5/8/14 18:09:03:024 CST     5/8/14 18:09:03:024 CST com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException com.ibm.ws.r

sadapter.jdbc.WSJccPreparedStatement.pmiExecuteUpdate 807 /opt/IBM/WebSphere/AppServer/profiles/check/logs/ffdc/wf_srv2_5b205b2_14.05.08_18.09

.03.0248465002192407646866.txt

     3      1     5/8/14 18:09:03:098 CST     5/8/14 18:09:03:098 CST com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException com.ibm.ws.r

sadapter.jdbc.WSJdbcPreparedStatement.executeUpdate 449 /opt/IBM/WebSphere/AppServer/profiles/check/logs/ffdc/wf_srv2_5b205b2_14.05.08_18.09.0

3.0981446527591284546629.txt

     4      1     5/9/14 14:46:28:738 CST     5/9/14 14:46:28:738 CST org.apache.soap.SOAPException com.ibm.ws.management.connector.soap.SOAPC

onnectorClient.invokeTemplate 846 /opt/IBM/WebSphere/AppServer/profiles/check/logs/ffdc/wf_srv2_2fae2fae_14.05.09_14.46.28.7386444650700322299

867.txt

------+------+---------------------------+---------------------------+---------------------------

[loguser@wfpreapp2 ffdc]$ pwd

/opt/IBM/WebSphere/AppServer/profiles/check/logs/ffdc

 

ddddd 

http://dl2.iteye.com/upload/attachment/0096/9412/52a9b096-a35e-3279-9a4b-62511b9863c1.png

http://dl2.iteye.com/upload/attachment/0096/9414/13689d19-ec6e-3454-8133-677c5e907fa5.png

  

异常解决:

最终是因为WAS 集群应用中 两台WAS 连接数据库的驱动jar 不一致导致性能异常,导入最新驱动包解决 

 

问题5:

Loadrunner WebService Script:

D:\TestCase\20140428_OA_workflow_db2_update\tc_workflow_endTask_soap_request\Action.c

 

C代码 
  1. Action()  
  2. {  
  3.     lr_start_transaction("审批流程");  
  4.   
  5.     web_add_header("Content-Type","application/xml");  
  6.   
  7.  // web_add_header("Content-Type","application/xml;charset=utf-8");  
  8.   
  9.     web_reg_find("Fail=NotFound",  
  10.         "Search=All",  
  11.         "SaveCount=placeflag",  
  12.         "Text=COMPLETE",  
  13.         LAST);  
  14.   
  15.     soap_request("StepName=SOAP Request",                                         
  16.         //"URL=http://esbpre.cns*****.com:9106/SuN***ServiceWeb/mb",   // 如经如经ESB PRE压测则改成这个                                      
  17.         "URL=http://10.19.218.179/snf-workflow-web/webservice/EngineService",                                         
  18.         "SOAPEnvelope="  
  19.         "<?xml version=\"1.0\" encoding=\"GB2312\"?>"  
  20.         "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"  
  21.             "<soap:Body>"  
  22. 、、、、、、  
  23.             "</soap:Body>"  
  24.         "</soap:Envelope>",                                         
  25.         "SOAPAction=endTask",                                         
  26.         "ResponseParam=response",                                         
  27.         "Snapshot=t1398759266.inf",                                       
  28.         LAST);  
  29.   
  30.     lr_output_message("output message:%s",lr_eval_string("{placeflag}"));  
  31.   
  32.      if((atoi(lr_eval_string("{placeflag}"))<1))  
  33.      {    
  34.      lr_end_transaction("审批流程",LR_PASS);            
  35.      }    
  36.      else    
  37.      {  
  38.      lr_end_transaction("审批流程",LR_FAIL);    
  39.      }  
  40.   
  41.     return 0;  
  42. }   

 

Loadrunner Replay log:

、、、

Action.c(98): Warning: The string 'placeflag' with parameter delimiters is not a parameter.

、、、

原因:

Loadrunner webservice协议的测试脚本soap_request() 方法不支持loadrunner http协议的web_reg_find检查点函数

解决一

所以改成web service 脚本soap_request方法的检查点函数

D:\TestCase\20140428_OA_workflow_db2_update\tc_workflow_endTask_soap_request\Action.c

 

C代码 
  1. Action()  
  2. {  
  3.     lr_start_transaction("审批流程");  
  4.   
  5.     web_add_header("Content-Type","application/xml");  
  6.   
  7.  // web_add_header("Content-Type","application/xml;charset=utf-8");  
  8.   
  9. /*     http 协议的检查点函数不适用web service 检查点 
  10.     web_reg_find("Fail=NotFound", 
  11.         "Search=All", 
  12.         "SaveCount=placeflag", 
  13.         "Text=FAIL", 
  14.         LAST); 
  15. */  
  16.     soap_request("StepName=SOAP Request",                                         
  17.         //"URL=http://esbpre.cns*****.com:9106/SuN***ServiceWeb/mb",   // 如经如经ESB PRE压测则改成这个                                      
  18.         "URL=http://10.19.218.179/snf-workflow-web/webservice/EngineService",                                         
  19.         "SOAPEnvelope="  
  20.         "<?xml version=\"1.0\" encoding=\"GB2312\"?>"  
  21.         "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"  
  22.             "<soap:Body>"  
  23. 、、、、、、  
  24.             "</soap:Body>"  
  25.         "</soap:Envelope>",                                         
  26.         "SOAPAction=endTask",                                         
  27. //此处表示保留web service 的response返回数据,不能缺失  
  28.         "ResponseParam=response",                                         
  29.         "Snapshot=t1398759266.inf",                                       
  30.         LAST);  
  31.   
  32. //   lr_output_message("output message:%s",lr_eval_string("{response}"));  
  33. //   if((atoi(lr_eval_string("{placeflag}"))>0))  
  34. //   if(strstr(lr_eval_string("{response}"),"FAIL")>0)  
  35.   
  36. // 改成web service 的检查点函数方法  
  37.      if(strstr(lr_eval_string("{response}"),"COMPLETE")>0)  
  38.      {    
  39.      lr_end_transaction("审批流程",LR_PASS);            
  40.      }    
  41.      else    
  42.      {  
  43.      lr_end_transaction("审批流程",LR_FAIL);    
  44.      }  
  45.   
  46.      return 0;  
  47. }  

 解决二:

直接将loadrunner webservice协议的soap_request()方法改成loadrunner http协议的web_custom_resquest()方法,再使用 web_reg_find()函数的检查点,即可。

D:\TestCase\20140428_OA_workflow_db2_update\tc_workflow_endTask_web_custom_request\Action.c

C代码 
  1. Action()  
  2. {  
  3.     lr_start_transaction("审批流程");  
  4.   
  5.     //web_add_header("Content-Type","application/xml");  
  6.   
  7.  // web_add_header("Content-Type","application/xml;charset=utf-8");  
  8.   
  9.     web_reg_find("Fail=NotFound",  
  10.         "Search=All",  
  11.         "SaveCount=placeflag",  
  12.         "Text=COMPLETE",  
  13.         LAST);  
  14. //转换成 http协议  
  15.     web_custom_request("Test",  
  16.                       "Method=POST",   
  17.         "URL=http://10.19.218.179/snf-workflow-web/webservice/EngineService",                                         
  18.         "EncType=text/xml;charset=GB2312",    //增加编码方式  
  19.         "Body="  
  20.         "<?xml version=\"1.0\" encoding=\"GB2312\"?>"  
  21.         "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"  
  22.             "<soap:Body>"  
  23. 、、、、、、  
  24.             "</soap:Body>"  
  25.         "</soap:Envelope>",             
  26. // 去掉web service XML的response返回数据  
  27.         LAST);  
  28.   
  29.     lr_output_message("output message:%s",lr_eval_string("{placeflag}"));  
  30.   
  31.      if((atoi(lr_eval_string("{placeflag}"))>0))  
  32.      {    
  33.      lr_end_transaction("审批流程",LR_PASS);            
  34.      }    
  35.      else    
  36.     {  
  37.      lr_end_transaction("审批流程",LR_FAIL);    
  38.      }  
  39.     return 0;  
  40. }  
  41.       

 

问题6 / loadrunner esb / loadrunner baowen / loadrunner xml

1.在执行数据易道压测的时候,出现同样的脚本调用jboss服务可以成功,但是中间多了一个ESB的服务后就发现脚本不通。在ESB端的日志发现LR请求的消息为空,但是去掉ESB直接调jboss 就是ok的,后来经过专家分析,在脚本中添加如下红色部分就ok了。原因是LR脚本中未指定文本类型,导致ESB解析消息时,不知道类型导致解析消息失败,由于jboss能自动识别,所以没有该问题出现。

脚本如下:

Action()
{
		web_reg_find("Fail=NotFound",
		"Search=Body",
		"SaveCount=Flag",
		"Text=<Status>COMPLETE</Status>",
		LAST);
                // 加上下面这行函数就可以向ESB发送报文了
		web_add_header("Content-Type","text/xml");

    lr_start_transaction("获取供应商指定小时的实时指标");
    
     web_custom_request("web_custom_request",
      "URL=http://esbpre.cns*****.com:9106/SuNingServiceWeb/mb",
      "Method=POST",    
			"Body="
			"<MbfService>"
			"<input1>"
			"<MbfHeader>"
			"<UId>2c8fdddd7eba4ed5a1af3baf65987dd4d5b9d1982994475a</UId>"
			"<Operation>getVenderRTDataByHour</Operation>"
			"<AuthId>SDAS;giXGBMoOWRAV</AuthId>"
			"<ServiceCode>CStoreMgmt</ServiceCode>"
			"<AppCode>SDAS</AppCode>"
			"</MbfHeader>"
			"<MbfBody>"
			"<hour>18</hour>"
			"<vendorCd>10030188</vendorCd>"
			"<type>all</type>"
			"<statisDate>20140917</statisDate>"
			"</MbfBody>"
			"</input1>"
			"</MbfService>",
      LAST);
lr_end_transaction("获取供应商指定小时的实时指标", LR_AUTO);
 
return 0;
}

 

loadrunner测试http的长连接 / 长链接 / web 长连接 / web 长链接 / loadrunner_http长连接设置

http://www.51testing.com/html/48/202848-241574.html

-

loadrunner测试mq的长连接 / 长链接 / web 长连接 / web 长链接

loadrunner java测试类中mq的初始化方法放在 init 方法里,循环放在action里即可

如:车辆GPS场景,长连接发数据且24小时发送地理位置GIS信息

 

Loadrunner Run-time Settings 里设置短连接 / 每次新用户,短连接

http://dl2.iteye.com/upload/attachment/0112/8912/581b1e9f-d210-3006-a6a0-63dc4489f19e.png

 

loadrunner 压测多台服务器,且保持长链接设置方法如下:

 

 

 

用Loadrunner录制和测试WebSphere MQ / loadrunner mq / loadrunner was mq

http://bbs.51testing.com/thread-138553-1-1.html

首先安装 MQ License
然后安装9.1中的附件
安装MQTEST
安装成功后可以在录制 协议 中看见
支持的语言Application being recorded must be written in C/C++ or Visual Basic.
缺点不支持JAVA

 

Testing WebSphere MQ with LoadRunner

http://www.myloadtest.com/loadrunner-websphere-mq/ 

 

/*
 * Example WebSphere MQ LoadRunner script (written in Java)
 * 
 * Script Description: 
 *     This script puts a message on a queue, then gets a response message from 
 *     another queue.
 *
 * You will probably need to add the following jar files to your classpath
 *   - com.ibm.mq.jar
 *   - connector.jar
 *   - com.ibm.mq.jmqi.jar
 *   - com.ibm.mq.headers.jar
 *   - com.ibm.mq.commonservices.jar
 */
 
import lrapi.lr;
import com.ibm.mq.*;
 
public class Actions
{
    // Variables used by more than one method
    String queueMgrName = "TESTQMGR";
    String putQueueName = "TEST.INBOUND.QUEUE";
    String getQueueName = "TEST.REPLY.QUEUE";
 
    MQQueueManager queueMgr = null;
    MQQueue getQueue = null;
    MQQueue putQueue = null;
    MQPutMessageOptions pmo = new MQPutMessageOptions();
    MQGetMessageOptions gmo = new MQGetMessageOptions();
    MQMessage requestMsg = new MQMessage();
    MQMessage responseMsg = new MQMessage();
    String msgBody = null;
 
    public int init() throws Throwable {
        // Open a connection to the queue manager and the put/get queues
        try {
            // As values set in the MQEnvironment class take effect when the 
            // MQQueueManager constructor is called, you must set the values 
            // in the MQEnvironment class before you construct an MQQueueManager object.
            MQEnvironment.hostname="mqsvr.myloadtest.com";
            MQEnvironment.port=1414;
            MQEnvironment.channel = "WMQTOOL.ADMIN.CLIENT";
            queueMgr = new MQQueueManager(queueMgrName);
 
            // Access the put/get queues. Note the open options used.
            putQueue = queueMgr.accessQueue(putQueueName, MQC.MQOO_BIND_NOT_FIXED | MQC.MQOO_OUTPUT);
            getQueue= queueMgr.accessQueue(getQueueName, MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT);
        } catch(Exception e) {
            lr.error_message("Error connecting to queue manager or accessing queues.");
            lr.exit(lr.EXIT_VUSER, lr.FAIL);
        }
 
        return 0;
    }//end of init
 
    public int action() throws Throwable {
        // This is an XML message that will be put on the queue. Could do some fancy 
        // things with XML classes here if necessary.
        // The message string can contain {parameters} if lr.eval_string() is used.
        msgBody = lr.eval_string("<TestMessage><value>{OrderNum}<value></TestMessage>"); 
 
        // Clear the message objects on each iteration.
        requestMsg.clearMessage();
        responseMsg.clearMessage();
 
        // Create a message object and put it on the request queue
        lr.start_transaction("test_message");
        try {
            pmo.options = MQC.MQPMO_NEW_MSG_ID; // The queue manager replaces the contents of the MsgId field in MQMD with a new message identifier.
            requestMsg.replyToQueueName = getQueueName; // the response should be put on this queue
            requestMsg.report=MQC.MQRO_PASS_MSG_ID; //If a report or reply is generated as a result of this message, the MsgId of this message is copied to the MsgId of the report or reply message.
            requestMsg.format = MQC.MQFMT_STRING; // Set message format. The application message data can be either an SBCS string (single-byte character set), or a DBCS string (double-byte character set). 
            requestMsg.messageType=MQC.MQMT_REQUEST; // The message is one that requires a reply.
            requestMsg.writeString(msgBody); // message payload
            putQueue.put(requestMsg, pmo);
        } catch(Exception e) {
        	lr.error_message("Error sending message.");
        	lr.exit(lr.EXIT_VUSER, lr.FAIL);
        }
 
        // Get the response message object from the response queue
        try {
            responseMsg.correlationId = requestMsg.messageId; // The Id to be matched against when getting a message from a queue
            gmo.matchOptions=MQC.MQMO_MATCH_CORREL_ID; // The message to be retrieved must have a correlation identifier that matches the value of the CorrelId field in the MsgDesc parameter of the MQGET call.
            gmo.options=MQC.MQGMO_WAIT; // The application waits until a suitable message arrives.
            gmo.waitInterval=60000; // timeout in ms
            getQueue.get(responseMsg, gmo);
 
            // Check the message content
            byte[] responseMsgData = responseMsg.readStringOfByteLength(responseMsg.getTotalMessageLength()).getBytes();
            String msg = new String(responseMsgData);
            lr.output_message(msg); // for debugging. Disable this for a load test.
            // TODO: add your own message checking here using string functions.
            // I have found that extracting XML fields and comparing them (rather than 
            // comparing the whole message body or substrings) is more resistant to change.
            // If no match is found, then lr.error_message() and lr.exit().
        } catch() {
            lr.error_message("Error receiving message.");
            lr.exit(lr.EXIT_VUSER, lr.FAIL);
        }
        lr.end_transaction("test_message", lr.AUTO);
 
        return 0;
    }//end of action
 
    public int end() throws Throwable {
        // 	Close all the connections
        try {
            putQueue.close();
            getQueue.close();
            queueMgr.close();
        } catch(Exception e) {
            lr.error_message("Exception in closing the connections");
            lr.exit(lr.EXIT_VUSER, lr.FAIL);
        }
 
        return 0;
    }//end of end
}

 

 

使用LoadRunner遇到无法维持长连接的问题

http://bbs.51testing.com/thread-48408-1-1.html

 

使用的是LoadRunner 8.0+web service pack.
我在RunTime Setting 中的preferences中已经设定了Keep-alive HTTP connection为Yes.
使用Wsdl方式录制 web service (soap)脚本 后,在Action中指定了发送请求的操作。
实际运行 指定循环1000次,用ethereal抓包发现,每次的http连接都被断掉。
检查 抓到的包体:
在Post请求的头域中, 给出
请求消息为SendSMS HTTP1.1
连接头域为Connection: Keep-Alive

在服务 器的回应中,没有给出connection头域,
使用的编码方式为Transfer-Encoding: chunked.

但是在LR收到该请求后,它发出了FIN-ACK包拆除了已有的连接。
重新建立一个新的连接再次发送请求。
但是我希望它以长连接的方式在已经建立的端口发送,从而提高效率。

 

 

你是否在runtime setting中选上了"simulate a new user each iteration"

这样的话,每次迭代,会断开重连.去掉此选项.
用ethereal抓包分析.表扬一下!

 

 

在脚本中手动写入循环,总算实现了所谓的长连接。
然后在设定中选取每REQUEST单位统计。

 

二楼说的设置是在HTML协议录制时才有的,用WEB SERVICE是没这个东西的,与你说的没有关系。
我以前没注意过这方面的问题。但我建议你先看一下软件在实际使用中是否也是要断开的,如果也需要断开,那我建议你不要改脚本,让脚本反映真实情况是最好的做法。
如果确实需要想办法解决这个问题,就需要检查脚本执行过程中什么时候断开连接,我估计有几个可能:
1。循环1次断1次连接,那肯定是header的问题,它修改了头文件导致需要重新连接,语句肯定是一开始的web_add_auto_header,修 改脚本中的相关内容,或者(也许是并且,没把握)调整录制属性中的header,content,修改脚本的方式是将这些内容放在脚本初始化部分;
2。每调用SOAP1次就断1次,那估计有可能是header问题,也可能是soap_request代码的问题。检查方法是试着把 web_add_header内容合并到web_add_auto_header里去。如果是soap_request导致必须先断开才能再调用,那我估 计这个问题没法解决。

 

确实的,在LR8.0版本中,关于webservice的已经命名为“web service”协议了,在runtimesetting中没有browser选项了
但是在7.51版本之前的webservice测试,使用的协议名称为“SOAP”,runtimesetting中有browser emulation选项的。特此更正。

 

晕,在帮助中都查到了相应的条文,目前暂时还没有发现对应的设定sdlkfj1

 

我直接在脚本中写入循环,就用简单的for循环。
在Run-time Setting ->Miscellaneous->Automatic Transactions中define each step as a transaction.

 

 

to jackloo
在http1.1中实现了所谓的长连接,根据我的测试,在使用长连接的情况下,最大北向吞吐量(tomcat+axis)是700左右, (tomcat+xfire)是1600左右。如果使用短连接,最大北向吞吐量(tomcat+axis)是450左右, (tomcat+xfire)是1200左右。同时,CPU的占用率降低了20%左右。(4*3G CPU, 2G MEM, JRE1.4.2)
可见,长连接在降低系统开销方面还是有优势的。

基于此,所以我们希望使用长连接来进行测试。
在脚本中写入循环后,runtime setting中的iteration次数可以写成1,循环次数在脚本中给定。

LoadRunner的确功能强大,不过很多地方还是需要动手去调整阿~~

 

 

 

[求助] 使用LoadRunner遇到无法维持长连接的问题,谢谢大牛了!!!

使用的是LoadRunner 8.0+web service pack.
我在RunTime Setting 中的preferences中已经设定了Keep-alive HTTP connection为Yes.
使用Wsdl方式录制 web service (soap)脚本 后,在Action中指定了发送请求的操作。
实际运行 指定循环1000次,用ethereal抓包发现,每次的http连接都被断掉。
检查 抓到的包体:
在Post请求的头域中, 给出
请求消息为SendSMS HTTP1.1
连接头域为Connection: Keep-Alive

在服务 器的回应中,没有给出connection头域,
使用的编码方式为Transfer-Encoding: chunked.

但是在LR收到该请求后,它发出了FIN-ACK包拆除了已有的连接。
重新建立一个新的连接再次发送请求。
但是我希望它以长连接的方式在已经建立的端口发送,从而提高效率。

项目 紧急,请大大们不吝赐教,十分感谢!!!!
收藏 分享

 

 

你是否在runtime setting中选上了"simulate a new user each iteration"

这样的话,每次迭代,会断开重连.去掉此选项.

用ethereal抓包分析.表扬一下!

TOP

 
多谢楼上的指点,不过我翻遍了Controller和User Generator中关于runtime setting的所有设置,并没有发现你所说的选项啊,请解释详细一点,谢谢!!
我用的是LR8.0+web service pack 1
 

TOP

 
晕,在帮助中都查到了相应的条文,目前暂时还没有发现对应的设定sdlkfj1

TOP

 
呵呵,最后没有办法,在脚本中手动写入循环,总算实现了所谓的长连接。
然后在设定中选取每REQUEST单位统计。
 
你脚本怎么写的。二楼说的在:runtime setting->browser emulation里。
 

 

 
二楼说的设置是在HTML协议录制时才有的,用WEB SERVICE是没这个东西的,与你说的没有关系。
我以前没注意过这方面的问题。但我建议你先看一下软件在实际使用中是否也是要断开的,如果也需要断开,那我建议你不要改脚本,让脚本反映真实情况是最好的做法。
如果确实需要想办法解决这个问题,就需要检查脚本执行过程中什么时候断开连接,我估计有几个可能:
1。循环1次断1次连接,那肯定是header的问题,它修改了头文件导致需要重新连接,语句肯定是一开始的web_add_auto_header,修 改脚本中的相关内容,或者(也许是并且,没把握)调整录制属性中的header,content,修改脚本的方式是将这些内容放在脚本初始化部分;
2。每调用SOAP1次就断1次,那估计有可能是header问题,也可能是soap_request代码的问题。检查方法是试着把 web_add_header内容合并到web_add_auto_header里去。如果是soap_request导致必须先断开才能再调用,那我估 计这个问题没法解决。
 

TOP

 
二楼说的设置是在HTML协议录制时才有的,用WEB SERVICE是没这个东西的,与你说的没有关系。
我以前没注意过这方面的问题。但我建议你先看一下软件在实际使用中是否也是要断开的,如果也需要断开,那我建议你不要改脚本,让脚本反映真实情况是最好的做法。
如果确实需要想办法解决这个问题,就需要检查脚本执行过程中什么时候断开连接,我估计有几个可能:
1。循环1次断1次连接,那肯定是header的问题,它修改了头文件导致需要重新连接,语句肯定是一开始的web_add_auto_header,修 改脚本中的相关内容,或者(也许是并且,没把握)调整录制属性中的header,content,修改脚本的方式是将这些内容放在脚本初始化部分;
2。每调用SOAP1次就断1次,那估计有可能是header问题,也可能是soap_request代码的问题。检查方法是试着把 web_add_header内容合并到web_add_auto_header里去。如果是soap_request导致必须先断开才能再调用,那我估 计这个问题没法解决。

TOP

 

呵呵!

原帖由 jackloo 于 2006-11-13 10:38 发表
二楼说的设置是在HTML协议录制时才有的,用WEB SERVICE是没这个东西的,与你说的没有关系。

确实的,在LR8.0版本中,关于webservice的已经命名为“web service”协议了,在runtimesetting中没有browser选项了
但是在7.51版本之前的webservice测试,使用的协议名称为“SOAP”,runtimesetting中有browser emulation选项的。特此更正。

TOP

 
我直接在脚本中写入循环,就用简单的for循环。
在Run-time Setting ->Miscellaneous->Automatic Transactions中define each step as a transaction.

TOP

 
to jackloo
在http1.1中实现了所谓的长连接,根据我的测试,在使用长连接的情况下,最大北向吞吐量(tomcat+axis)是700左右, (tomcat+xfire)是1600左右。如果使用短连接,最大北向吞吐量(tomcat+axis)是450左右, (tomcat+xfire)是1200左右。同时,CPU的占用率降低了20%左右。(4*3G CPU, 2G MEM, JRE1.4.2)
可见,长连接在降低系统开销方面还是有优势的。

基于此,所以我们希望使用长连接来进行测试。
在脚本中写入循环后,runtime setting中的iteration次数可以写成1,循环次数在脚本中给定。

LoadRunner的确功能强大,不过很多地方还是需要动手去调整阿~~

 

loadrunner 学习笔记--Web Services

http://www.byywee.com/page/M0/S227/227297.html

使用loadrunner测试Web Services的程序

http://blog.sina.com.cn/s/blog_7833c84501010e9d.html

首页>> 文章精选>> 测试丛书>> 性能测试进阶指南——LoadRunner 11实战>> 查看资讯

性能测试进阶指南—LoadRunner 11实战(20) 发布时间: 2012-6-11 10:42 作者: 陈霁

http://www.51testing.com/html/42/n-815142.html

Loadrunner上传文件解决办法(大文件)

http://www.chinatesting.cn/212/12929212.shtml

 

loadrunner 与 xml / loadrunner 与报文 / loadrunner 与Json格式

Action()
{
   web_reg_find("Fail=NotFound",
   "Search=Body",
   "SaveCount=Flag",
   "Text=<flag>0</flag>",
   LAST);

   lr_start_transaction("koujianziyuan");

   web_custom_request("name",
   "URL=http://prescp.cns*****.com/scp-web/excuteSale.htm",
   "Method=POST",
   "Resource=1",
   "Mode=HTTP",
   "Referer=",
   "Body=<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<MbfService>"
"  <input1>"
"    <MbfHeader>"
"      <ServiceCode>excuteSale</ServiceCode>"
"      <Operation>1</Operation>"
"      <AppCode></AppCode>"
"      <UId>20bdfcb2089495aa04bed69d76cfdac69268f8dd5f64252</UId>"
"        <AuthId>POS;O0guYW8sNHON</AuthId>"
"    </MbfHeader>"
"	<MbfBody>"
  "<sourceSystem>POS</sourceSystem>"
  "<sourceList>"
   " <operateType>1</operateType>"
    "<subComId>1001</subComId>"
    "<store>*</store>"
   " <bu>00002</bu>"
    "<invLocat>*</invLocat>"
   " <channel>10</channel>"
   " <resType>0001</resType>"
    "<quato>10</quato>"
    "<serialNumber>CZC020206817610</serialNumber>"
  "</sourceList>"
"	</MbfBody>"
"  </input1>"
"</MbfService>",
   LAST);
	lr_end_transaction("koujianziyuan", LR_AUTO);

   return 0;

}

 

范例二 loadrunner 与 xml / loadrunner 与报文 / loadrunner 与Json格式

 Action()

{
	web_reg_find("Fail=NotFound",
	"Search=Body",
	"SaveCount=Flag",
	"Text=<flag>0</flag>",
	LAST);

   web_add_header("Content-Type","application/json;charset=utf-8");
   web_custom_request("modifyStatus",   "URL=http://possit.cns*****.com/nsf-sale-web/useCoupon/syncNonStdOrderCfmUse.do",
   "Method=POST",
   "Resource=0",
   "RecContentType=application/json",
   "Mode=HTTP",
   "EncType=application/json",
   "Referer=",
   "Body={"
"    \"MbfService\": {"
"        \"input1\": {"
"            \"MbfHeader\": {"
"                \"ServiceCode\": \"useCoupon\","
"                \"AppCode\": \"POS\","
"                \"Operation\": \"syncNonStdOrderCfmUse\","
"                \"AuthId\": \"\","
"                \"UId\": \"\""
"            },"
"            \"MbfBody\": {"
"                \"caller\": \"2\","
"                \"memberId\": \"6001769384\","
"                \"sourceSystemNo\": \"W011046957610\","
"                \"operateType\": \"1\","
"                \"channelId\": \"37\","
"                \"enddeviceId\": \"\","
"                \"cityId\": \"1000173\","
"                \"entityStoreId\": \"7610\","
"                \"productInfoType\": \"2\","
"                \"productList\": {"
"                    \"productInfo\": ["
"                        {"
"                            \"sourceSystemItemId\": \"W011046957610\","
"                            \"commdtyCode\": \"00000000010824614X\","
"                            \"productGrpId\": \"\","
"                            \"productListPrice\": \"1000.00\","
"                            \"storeId\": \"\","
"                            \"productQty\": \"1\""
"                        }"
"                    ]"
"                },"
"                \"couponUsedList\": {"
"                    \"couponUsedInfo\": ["
"                        {"
"                            \"couponNumber\": \"40000000081628\","
"                            \"changeHeterotypeId\": \"\""
"                        }"
"                    ]"
"                }"
"            }"
"        }"
"    }"
"",
   LAST);
   return 0;
}

 

loadrunner json

D:\TestCase\20160308_openTSDB

请求URL如下

http://10.27.113.44:4242/api/put

POST json文件格式如下

{"metric":"mysql.cpu","tags":{"host":"web9"},"timestamp":1307591390000,"value":"1"} 

以上这样的json参数直接放body发送过来

 

编写loadrunner 脚本如下:

D:\TestCase\20160308_openTSDB\tc_openTSDB_insert\Action.c

Action()
{
    lr_start_transaction("openTSDB插入数据");

    web_add_header("Content-type","application/json; charset=utf-8");

	web_add_header("connection","keep-alive");

	web_add_header("Accept","application/json");

	web_reg_find("Fail=NotFound",
		"Search=All",
		"Text=HTTP/1.1 204 No Content",
		LAST);

	web_custom_request("request", 
		"Method=POST", 
		"URL=http://{ip}:4242/api/put", 
		//"RecContentType=application/json; charset=UTF-8",
		"EncType=application/json; charset=UTF-8",
		"Resource=0",
		"Mode=HTTP",
		"Body={\"metric\":\"mysql.cpu{cpunum}\",\"tags\":{\"host\":\"web{webnum}\"},\"timestamp\":13082{timestamp},\"value\":\"{value}\"}",
		LAST);

	lr_end_transaction("openTSDB插入数据", LR_AUTO);

	return 0;
}

该场景测试结果

http://dl2.iteye.com/upload/attachment/0115/8310/7153c529-4991-3d17-ab99-ec0a6cb38677.png

 

优化项:/usr/share/opentsdb/etc/opentsdb/logback.xml文件日志级别由info改为error后压测插入场景TPS明显上升,TPS由1100上升至8354

场景名称

并发用户

OpenTSDB (CPU)

10.27.113.44

10.27.113.45

HBase (CPU)

10.27.113.47

10.27.113.48

10.27.113.49

TPS(笔/秒)

响应时间

()

插入场景只压单台

10.27.113.44

50

10.27.113.44

60%

均小于5%

7357

0.006

插入场景只压单台

10.27.113.44

100

10.27.113.44

70%,其中sys30%

均小于5%

8354

0.012

插入场景只压单台

10.27.113.45

50

10.27.113.45

60%

均小于5%

8113

0.006

插入场景只压单台

10.27.113.45

100

10.27.113.45

60%,其中sys30%

均小于5%

8738

0.011

插入场景压两台

100

50%40%

均小于5%

10550

0.009

插入场景压两台

200

50%40%

均小于5%

11427

0.016

查询场景只压单台

10.27.113.44

30

55%

均小于5%

56.7

0.517

 

loadrunner json 带中文字符传递,还要中文数据参数化,参考这个

tc_minos3_json_zhongwenzifu_encode_utf8.rar

http://dl.iteye.com/topics/download/e608b63d-2c0d-3145-a002-2f0040802ecf

\\10.19.95.2\d$\TestCase\20170321_minos3\tc_minos3_json_zhongwenzifu_encode_utf8\Action.c

Action()
{
/*
	1.参数的赋值和取值
	lr_save_string("中文","cn1");
	lr_eval_string("{cn1}");
	
	http://blog.csdn.net/lunarnan/article/details/7466809
	LoadRunner字符串编码转换的函数lr_convert_string_encoding
	
	http://www.cnblogs.com/aliy-pan/p/5659705.html
	loadrunner获取返回值为乱码

*/
    //web_add_header("Content-type","application/json; charset=utf-8");  
    //web_add_header("connection","keep-alive");  
    //web_add_header("Accept","application/json");
  
    lr_start_transaction("rsf");
    
    web_reg_find("Fail=NotFound",
            "Search=All",
            "SaveCount=hello",
            "Text=_CART01A", 
            LAST);

	lr_convert_string_encoding(lr_eval_string("{name}"),LR_ENC_SYSTEM_LOCALE,LR_ENC_UTF8,"para1"); //多条中文数据参数化,写法参考
		lr_convert_string_encoding("南京市",LR_ENC_SYSTEM_LOCALE,LR_ENC_UTF8,"para2"); //单条中文数据,写法参考
			lr_convert_string_encoding("购物车限购事件",LR_ENC_SYSTEM_LOCALE,LR_ENC_UTF8,"para3");
				lr_convert_string_encoding("江苏省",LR_ENC_SYSTEM_LOCALE,LR_ENC_UTF8,"para4");
					lr_convert_string_encoding("张三",LR_ENC_SYSTEM_LOCALE,LR_ENC_UTF8,"para5");
						lr_convert_string_encoding("弹子石腾龙大道蓝光COCO时代二期5栋27-12",LR_ENC_SYSTEM_LOCALE,LR_ENC_UTF8,"para6");
							lr_convert_string_encoding("玄武区",LR_ENC_SYSTEM_LOCALE,LR_ENC_UTF8,"para7");
//lr_eval_string("{parameter1}")
    web_custom_request("rsf",
             "Method=POST",
             //"EncType=application/json; charset=UTF-8",
             //"RecContentType=application/json; charset=UTF-8", 
             "URL=http://10.37.20.71:8080/minos/rsf",
             "Resource=0",  
        	 "Mode=HTTP",  
             "Body={\"isLog\":0,\"payCode\":\"WAYWARD\",\"townName\":\"{para1}\",\"favorableBillList\":[{\"promotionType\":\"5\",\"voucherAmount\":1000,\"voucherId\":\"2004052201\"}],\"cityName\":\"{para2}\",\"enable\":1,\"EVENTNAME\":\"{para3}\",\"handleWay\":1,\"provinceName\":\"{para4}\",\"taxPayerNo\":\"\",\"memType\":\"03\",\"invoiceTitle\":\"{para5}\",\"payTime\":\"1460362469171\",\"MONITORSTATISDATE\":\"2017-03-18_18_39\",\"couponList\":[{\"cardNo\":\"9253664487\",\"bankTypeCode\":\"90312\"}],\"isRuleInsert\":1,\"userId\":\"00000001404016\",\"getDeviceIdTime\":0,\"commodityList\":[{\"cmmdtyCode\":\"000000000109703565\",\"cmmdtyPrice\":19,\"itemNo\":\"002000000000006652\",\"payPrice\":31,\"cmmdtyQty\":1,\"cmmdtyBrand\":\"00015\",\"hopeArrivalTime\":1417622400000,\"cmmdtyGroup\":\"R6156001\",\"supplierCode\":\"001\",\"earliestServiceDate\":0}],\"isMain\":1,\"deviceId\":\"\",\"CODE\":0,\"EVENTCODE\":\"E_CART01\",\"isDbStore\":1,\"businessScenario\":\"01\",\"invoiceType\":\"02\",\"distributionMode\":\"01\",\"receiverMobile\":\"17011112222\",\"CURRENTRULECODE\":\"A\",\"isOff\":false,\"detailAddress\":\"{para6}\",\"RULECODE\":\"R_CART01A\",\"serialNo\":\"CSCE_CART0120160411f1c41207-202c-41a2-8e58-d4f1b30470f3\",\"districtName\":\"{para7}\",\"md5CustAddr\":\"8ad311034e0e6453855a343fce27608b\",\"townCode\":\"0250101\",\"cart2No\":\"222\"}",            
		     //"Body={string}",  //方法二,多条中文+英文行数据参数化的写法,暂未写
        EXTRARES,  
    LAST);

	lr_output_message("para1");

    lr_end_transaction("rsf", LR_AUTO);

	return 0;
}

 

 

 

 

end

  • 大小: 15.2 KB
  • 大小: 16.6 KB
  • 大小: 5.6 KB
  • 大小: 18.7 KB
  • 大小: 21.5 KB
  • 大小: 15.5 KB
  • 大小: 14.5 KB
  • 大小: 16.7 KB
  • 大小: 15.7 KB
  • 大小: 15.1 KB
  • 大小: 19.9 KB
  • 大小: 21.7 KB
  • 大小: 25.5 KB
  • 大小: 67.4 KB
  • 大小: 51.6 KB
  • 大小: 165.9 KB
  • 大小: 61.8 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics