性能测试流程
需求调研(性能的测试指标
设计性能测试场景(频繁使用的功能 核心业务 接口 混合
搭建环境(模拟真实的用户
开发脚本
检查点:对结束事务进行判断,默认结束状态是LR_AUTO
参数化:模拟真实用户使用
关联:服务器返回的动态参数
集合点:做并发测试
场景设计:单业务开发。核心业务并发、第三方接口、混合场景,监控服务器资源(cpu.内存,磁盘网络)
执行场景:发现问题,挑有
性能测试报告
一.脚本编写
案例一(登录注册手写脚本)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
案例二(登录注册手写脚本使用web_custom_request)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
案例三(随机订票方法一——选项固定)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
案例四(随机订票方法二——选项固定)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
|
案例五 (选项随机化——使用指针)
View Code
案例六 (选项随机化——使用字符串)
1 2 3 4 5 6 |
|
二.登录脚本编写流程及注意事项
1.流程
编写方式:录制和手写(下面记录手写方式)
需要工具:httpwatch 或者是 fiddler
具体流程:
执行一次登录,将请求通过抓包工具记录下来
筛选请求:如果没有特别要求,图片等格式需求可以忽略
将get请求写入脚本
将post请求写入脚本
寻找检查点——登录成功的网页>查看源码>复制成功登录判断点
插入检查点函数——放到请求登录成功网页的前面()
1 2 3 |
|
插入关联函数从服务器获得的动态参数
位置:放在第一次出现session值的网页前
1 2 3 4 |
|
添加if语句判断事务是否成功
(必须先有一个开始事物
(将结束事物替换为判断条件
1 2 3 4 5 |
|
2.注意事项
参数列表中设置选项选择312——唯一值,每次迭代更新
三.执行
工具——〉创建controler场景 如果出现错误检查是否注册码失效,或者用管理员运行LR
开启windows服务 ——〉services.msc——〉Remote Registry改为手动,然后启动
场景——〉集合(没有亮的话,回脚本界面 插入——〉集合 ,场景界面点击路径再重加载脚本 )
运行——〉可用图——〉windonws资源图——〉右键添加度量——〉添加——〉输入自己电脑的ip
四.分析结果
未完待续。。
备注:
web_get_int_property(HTTP_INFO_RETURN_CODE); // HTTP_INFO_RETURN_CODE : HTTP返回的状态码,获取状态码值。