码迷,mamicode.com
首页 > 其他好文 > 详细

【LoadRunner】如何对GIS服务器进行性能测试

时间:2017-11-23 19:45:09      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:cgi   isp   ict   app   测试经验   color   closed   ret   esri   

1、需求了解

  首先确定对gis服务器压测的测试范围,形成具体的测试用例,gis平台都是通过网页端的javascript api调用的gis集群服务接口,通过LR录制上一步中的业务操作,找到javascript向gis服务器请求的地址做参数化后形成压测脚本,实现对GIS服务器的压力测试。

2、测试范围

  ARCGIS性能测试主要范围有三个:ARCGIS生成基础地图服务、空间查询服务、为地图提供数据的服务接口的性能,本文主要对ARCGIS生成基础地图服务性能测试进行介绍。

3、测试工具

  LoadRunner 11

4、测试步骤

4.1脚本准备

利用loadrunner对地图查询业务进行录制,录制脚本如下:

技术分享图片
 1 Action()
 2 {
 3         lr_start_transaction("查询");
 4 
 5     web_custom_request("0_4", 
 6         "URL=http://xxx.xx.x.xxx:xxxx/arcgis/rest/services/xxx/{服务名称}/MapServer/0?f=json", 
 7         "Method=GET", 
 8         "Resource=0", 
 9         "Referer=http://xxx.xx.x.xxx:xxxx/xxxgis/aigis/map.html?module=%E4%B8%9A%E5%8A%A1%E5%88%86%E5%B8%83", 
10         "Mode=HTML", 
11         "EncType=application/x-www-form-urlencoded", 
12         EXTRARES, 
13         "Url=0?f=json", "Referer=http://xxx.xx.x.xxx:xxxx/xxxgis/aigis/map.html?module=%E4%B8%9A%E5%8A%A1%E5%88%86%E5%B8%83", ENDITEM, 
14         LAST);
15 
16     web_custom_request("query_15", 
17         "URL=http://xxx.xx.x.xxx:xxxx/arcgis/rest/services/xxx/{服务名称}/MapServer/0/query?f=json&where={行政代码}&returnGeometry=true&spatialRel=esriSpatialRelIntersects&maxAllowableOffset=9783&geometry=%7B%22xmin%22%3A5009377.08569099%2C%22ymin%22%3A5009377.085700966%2C%22xmax%22%3A10018754.171386972%2C%22ymax%22%3A10018754.171396947%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&geometryType=esriGeometryEnvelope&inSR=102100&outFields=CODE%2CNAME%2CFID&"
18         "outSR=102100", 
19         "Method=GET", 
20         "Resource=0", 
21         "Referer=http://xxx.xx.x.xxx:xxxx/xxxgis/aigis/map.html?module=%E4%B8%9A%E5%8A%A1%E5%88%86%E5%B8%83", 
22         "Mode=HTML", 
23         "EncType=application/x-www-form-urlencoded", 
24         LAST);
25 
26     web_custom_request("query_16", 
27         "URL=http://xxx.xx.x.xxx:xxxx/arcgis/rest/services/xxx/{服务名称}/MapServer/0/query?f=json&where={行政代码}&returnGeometry=true&spatialRel=esriSpatialRelIntersects&maxAllowableOffset=9783&geometry=%7B%22xmin%22%3A10018754.171386972%2C%22ymin%22%3A5009377.085700966%2C%22xmax%22%3A15028131.257082947%2C%22ymax%22%3A10018754.171396947%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&geometryType=esriGeometryEnvelope&inSR=102100&outFields="
28         "CODE%2CNAME%2CFID&outSR=102100", 
29         "Method=GET", 
30         "Resource=0", 
31         "Referer=http://xxx.xx.x.xxx:xxxx/xxxgis/aigis/map.html?module=%E4%B8%9A%E5%8A%A1%E5%88%86%E5%B8%83", 
32         "Mode=HTML", 
33         "EncType=application/x-www-form-urlencoded", 
34         LAST);
35 
36     web_custom_request("query_17", 
37         "URL=http://xxx.xx.x.xxx:xxxx/arcgis/rest/services/xxx/{服务名称}/MapServer/0/query?f=json&where={行政代码}&returnGeometry=true&spatialRel=esriSpatialRelIntersects&maxAllowableOffset=9783&geometry=%7B%22xmin%22%3A15028131.257082947%2C%22ymin%22%3A5009377.085700966%2C%22xmax%22%3A20037508.34277893%2C%22ymax%22%3A10018754.171396947%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&geometryType=esriGeometryEnvelope&inSR=102100&outFields=CODE%2CNAME%2CFID"
38         "&outSR=102100", 
39         "Method=GET", 
40         "Resource=0", 
41         "Referer=http://xxx.xx.x.xxx:xxxx/xxxgis/aigis/map.html?module=%E4%B8%9A%E5%8A%A1%E5%88%86%E5%B8%83", 
42         "Mode=HTML", 
43         "EncType=application/x-www-form-urlencoded", 
44         LAST);
45 
46     web_custom_request("query_18", 
47         "URL=http://xxx.xx.x.xxx:xxxx/arcgis/rest/services/xxx/{服务名称}/MapServer/0/query?f=json&where={行政代码}&returnGeometry=true&spatialRel=esriSpatialRelIntersects&maxAllowableOffset=9783&geometry=%7B%22xmin%22%3A5009377.08569099%2C%22ymin%22%3A0.000004988163709640503%2C%22xmax%22%3A10018754.171386972%2C%22ymax%22%3A5009377.085700966%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&geometryType=esriGeometryEnvelope&inSR=102100&outFields="
48         "CODE%2CNAME%2CFID&outSR=102100", 
49         "Method=GET", 
50         "Resource=0", 
51         "Referer=http://xxx.xx.x.xxx:xxxx/xxxgis/aigis/map.html?module=%E4%B8%9A%E5%8A%A1%E5%88%86%E5%B8%83", 
52         "Mode=HTML", 
53         "EncType=application/x-www-form-urlencoded", 
54         LAST);
55 
56     web_custom_request("query_19", 
57         "URL=http://xxx.xx.x.xxx:xxxx/arcgis/rest/services/xxx/{服务名称}/MapServer/0/query?f=json&where={行政代码}&returnGeometry=true&spatialRel=esriSpatialRelIntersects&maxAllowableOffset=9783&geometry=%7B%22xmin%22%3A10018754.171386972%2C%22ymin%22%3A0.000004988163709640503%2C%22xmax%22%3A15028131.257082947%2C%22ymax%22%3A5009377.085700966%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&geometryType=esriGeometryEnvelope&inSR=102100&outFields="
58         "CODE%2CNAME%2CFID&outSR=102100", 
59         "Method=GET", 
60         "Resource=0", 
61         "Referer=http://xxx.xx.x.xxx:xxxx/xxxgis/aigis/map.html?module=%E4%B8%9A%E5%8A%A1%E5%88%86%E5%B8%83", 
62         "Mode=HTML", 
63         "EncType=application/x-www-form-urlencoded", 
64         LAST);
65 
66     web_reg_save_param("StatusCode","LB=\"alias\":\"","RB=\",\"length\"",LAST);
67     web_custom_request("query_20", 
68         "URL=http://xxx.xx.x.xxx:xxxx/arcgis/rest/services/xxx/{服务名称}/MapServer/0/query?f=json&where={行政代码}&returnGeometry=true&spatialRel=esriSpatialRelIntersects&outFields=CODE%2CNAME%2CFID&outSR=102100", 
69         "Method=GET", 
70         "Resource=0", 
71         "Referer=http://xxx.xx.x.xxx:xxxx/xxxgis/aigis/map.html?module=%E4%B8%9A%E5%8A%A1%E5%88%86%E5%B8%83", 
72         "Mode=HTML", 
73         "EncType=application/x-www-form-urlencoded", 
74         LAST);
75 
76     web_custom_request("query_21", 
77         "URL=http://xxx.xx.x.xxx:xxxx/arcgis/rest/services/xxx/{服务名称}/MapServer/0/query?f=json&where={行政代码}&returnGeometry=true&spatialRel=esriSpatialRelIntersects&maxAllowableOffset=9783&geometry=%7B%22xmin%22%3A15028131.257082947%2C%22ymin%22%3A0.000004988163709640503%2C%22xmax%22%3A20037508.34277893%2C%22ymax%22%3A5009377.085700966%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&geometryType=esriGeometryEnvelope&inSR=102100&outFields="
78         "CODE%2CNAME%2CFID&outSR=102100", 
79         "Method=GET", 
80         "Resource=0", 
81         "Referer=http://xxx.xx.x.xxx:xxxx/xxxgis/aigis/map.html?module=%E4%B8%9A%E5%8A%A1%E5%88%86%E5%B8%83", 
82         "Mode=HTML", 
83         "EncType=application/x-www-form-urlencoded", 
84         LAST);
85 
86 //     lr_end_transaction("查询",LR_AUTO);
87     if (strstr(lr_eval_string("{StatusCode}"),"CODE")!=NULL) {
88         lr_end_transaction("查询",LR_PASS);
89     }
90     else{
91         lr_end_transaction("查询",LR_FAIL);
92         lr_error_message("行政区划名称与代码:%s",lr_eval_string("{服务名称}""__""{行政代码}"));
93     }
94     return 0;
95 }
View Code

其中主要参数为服务名称行政代码geometry,服务名称为系统中的行政区划服务,包括AdminProvince(省级)、AdminDistrict(市级)与AdminCounty(县级)等;where=CODE+like+%{查询地区行政区划码}%25%27(根据具体项目决定);geometry代表空间查询使用的几何要素。

4.2请求范例

请求地址:

http://xxx.xx.x.xxx:xxxx/arcgis/rest/services/xxx/InsuranceCompany/MapServer/0/query

请求参数:

f: 返回内容格式(html/json)

where: 查询条件语句

returnGeometry: 是否返回几何要素

spatialRel: 空间查询关系

maxAllowableOffset: 简化返回的几何要素时,允许的最大偏移量

geometry: 空间查询使用的几何要素

geometryType: 空间查询使用的几何要素类型

inSR: 输入几何要素的坐标系

outFields: 需要返回的字段

outSR: 返回数据的坐标系

请求示例:

http://xxx.xx.x.xxx:xxxx/arcgis/rest/services/xxx/InsuranceCompany/MapServer/0/query?f=json&where=&returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry=%7B%22xmin%22%3A11778047.838733034%2C%22ymin%22%3A4605433.760798998%2C%22xmax%22%3A12815145.43850603%2C%22ymax%22%3A5446852.568161995%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&geometryType=esriGeometryEnvelope&inSR=102100&outFields=*&outSR=102100

返回内容:

Json数据

4.3脚本完善

对地图查询脚本进行参数化、数据准备以及添加判断等。

以上为,GIS项目测试经验总结。

【LoadRunner】如何对GIS服务器进行性能测试

标签:cgi   isp   ict   app   测试经验   color   closed   ret   esri   

原文地址:http://www.cnblogs.com/zhang-zhi/p/7885370.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!