Showing
1 changed file
with
405 additions
and
10 deletions
@@ -156,11 +156,11 @@ | @@ -156,11 +156,11 @@ | ||
156 | <stringProp name="shareMode">shareMode.all</stringProp> | 156 | <stringProp name="shareMode">shareMode.all</stringProp> |
157 | </CSVDataSet> | 157 | </CSVDataSet> |
158 | <hashTree/> | 158 | <hashTree/> |
159 | - <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_uid_cart_edit_5k" enabled="true"> | 159 | + <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_uid_edit_5k" enabled="true"> |
160 | <stringProp name="TestPlan.comments"></stringProp> | 160 | <stringProp name="TestPlan.comments"></stringProp> |
161 | <stringProp name="filename">/opt/jmeter/data/uid_cart_edit.csv</stringProp> | 161 | <stringProp name="filename">/opt/jmeter/data/uid_cart_edit.csv</stringProp> |
162 | <stringProp name="fileEncoding">utf-8</stringProp> | 162 | <stringProp name="fileEncoding">utf-8</stringProp> |
163 | - <stringProp name="variableNames">uid_cart_edit,address_id_edit,shopping_key_edit,coupon_code_1_edit,coupon_code_2_edit</stringProp> | 163 | + <stringProp name="variableNames">uid_edit,address_id_edit,shopping_key_edit,coupon_code_1_edit,coupon_code_2_edit</stringProp> |
164 | <stringProp name="delimiter">,</stringProp> | 164 | <stringProp name="delimiter">,</stringProp> |
165 | <boolProp name="quotedData">false</boolProp> | 165 | <boolProp name="quotedData">false</boolProp> |
166 | <boolProp name="recycle">true</boolProp> | 166 | <boolProp name="recycle">true</boolProp> |
@@ -168,11 +168,11 @@ | @@ -168,11 +168,11 @@ | ||
168 | <stringProp name="shareMode">shareMode.all</stringProp> | 168 | <stringProp name="shareMode">shareMode.all</stringProp> |
169 | </CSVDataSet> | 169 | </CSVDataSet> |
170 | <hashTree/> | 170 | <hashTree/> |
171 | - <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_uid_cart_submit_5k" enabled="true"> | 171 | + <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_uid_submit_5k" enabled="true"> |
172 | <stringProp name="TestPlan.comments">可购买的商品</stringProp> | 172 | <stringProp name="TestPlan.comments">可购买的商品</stringProp> |
173 | <stringProp name="filename">/opt/jmeter/data/uid_cart_submit.csv</stringProp> | 173 | <stringProp name="filename">/opt/jmeter/data/uid_cart_submit.csv</stringProp> |
174 | <stringProp name="fileEncoding">utf-8</stringProp> | 174 | <stringProp name="fileEncoding">utf-8</stringProp> |
175 | - <stringProp name="variableNames">uid_cart_submit,address_id,shopping_key_cart_submit,coupon_code_1,coupon_code_2</stringProp> | 175 | + <stringProp name="variableNames">uid_submit,address_id_submit,shopping_key_submit,coupon_code_1_submit,coupon_code_2_submit</stringProp> |
176 | <stringProp name="delimiter">,</stringProp> | 176 | <stringProp name="delimiter">,</stringProp> |
177 | <boolProp name="quotedData">false</boolProp> | 177 | <boolProp name="quotedData">false</boolProp> |
178 | <boolProp name="recycle">true</boolProp> | 178 | <boolProp name="recycle">true</boolProp> |
@@ -204,7 +204,7 @@ | @@ -204,7 +204,7 @@ | ||
204 | <stringProp name="shareMode">shareMode.all</stringProp> | 204 | <stringProp name="shareMode">shareMode.all</stringProp> |
205 | </CSVDataSet> | 205 | </CSVDataSet> |
206 | <hashTree/> | 206 | <hashTree/> |
207 | - <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="tg_app_Shopping_queryCart" enabled="true"> | 207 | + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="tg_web_brand_byDomain" enabled="true"> |
208 | <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | 208 | <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> |
209 | <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true"> | 209 | <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true"> |
210 | <boolProp name="LoopController.continue_forever">false</boolProp> | 210 | <boolProp name="LoopController.continue_forever">false</boolProp> |
@@ -217,10 +217,10 @@ | @@ -217,10 +217,10 @@ | ||
217 | <boolProp name="ThreadGroup.scheduler">false</boolProp> | 217 | <boolProp name="ThreadGroup.scheduler">false</boolProp> |
218 | <stringProp name="ThreadGroup.duration"></stringProp> | 218 | <stringProp name="ThreadGroup.duration"></stringProp> |
219 | <stringProp name="ThreadGroup.delay"></stringProp> | 219 | <stringProp name="ThreadGroup.delay"></stringProp> |
220 | - <stringProp name="TestPlan.comments">查询用户购物车</stringProp> | 220 | + <stringProp name="TestPlan.comments">根据域名查店铺信息(PC进店铺时会查询)</stringProp> |
221 | </ThreadGroup> | 221 | </ThreadGroup> |
222 | <hashTree> | 222 | <hashTree> |
223 | - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tc_app_Shopping_queryCart" enabled="true"> | 223 | + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tc_web_brand_byDomain" enabled="true"> |
224 | <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> | 224 | <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> |
225 | <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> | 225 | <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> |
226 | <collectionProp name="Arguments.arguments"> | 226 | <collectionProp name="Arguments.arguments"> |
@@ -245,13 +245,405 @@ | @@ -245,13 +245,405 @@ | ||
245 | <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | 245 | <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> |
246 | <boolProp name="HTTPSampler.monitor">false</boolProp> | 246 | <boolProp name="HTTPSampler.monitor">false</boolProp> |
247 | <stringProp name="HTTPSampler.embedded_url_re"></stringProp> | 247 | <stringProp name="HTTPSampler.embedded_url_re"></stringProp> |
248 | - <stringProp name="TestPlan.comments">查询用户购物车</stringProp> | 248 | + <stringProp name="TestPlan.comments">根据域名查店铺信息(PC进店铺时会查询)</stringProp> |
249 | </HTTPSamplerProxy> | 249 | </HTTPSamplerProxy> |
250 | <hashTree> | 250 | <hashTree> |
251 | <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="前置BeanShell" enabled="true"> | 251 | <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="前置BeanShell" enabled="true"> |
252 | <stringProp name="TestPlan.comments"></stringProp> | 252 | <stringProp name="TestPlan.comments"></stringProp> |
253 | <boolProp name="resetInterpreter">false</boolProp> | 253 | <boolProp name="resetInterpreter">false</boolProp> |
254 | - <stringProp name="parameters">${cart_shopping_key} ${cart_uid}</stringProp> | 254 | + <stringProp name="parameters">${shop_domain}</stringProp> |
255 | + <stringProp name="filename"></stringProp> | ||
256 | + <stringProp name="script">import java.security.MessageDigest; | ||
257 | +import java.util.Random; | ||
258 | +String[] clientTypes = {"web"}; | ||
259 | +String[] privateKeys = {"0ed29744ed318fd28d2c07985d3ba633"}; | ||
260 | +int rd = new Random().nextInt(1); | ||
261 | +String clientType = clientTypes[rd]; | ||
262 | +String privateKey = privateKeys[rd]; | ||
263 | + | ||
264 | +String req = "app_version=5.9.0&client_type="+clientType+"&domain="+bsh.args[0]+"&method=web.brand.byDomain&os_version=yohobuy:h5&private_key="+privateKey+"&screen_size=720x1280&v=7"; | ||
265 | +MessageDigest md = MessageDigest.getInstance("MD5"); | ||
266 | +byte[] btInput = req.getBytes(); | ||
267 | +md.update(btInput); | ||
268 | +byte[] btResult = md.digest(); | ||
269 | +StringBuffer sb = new StringBuffer(); | ||
270 | +for(byte b : btResult){ | ||
271 | + int bt = b&0xff; | ||
272 | + if(bt<16){ | ||
273 | + sb.append(0); | ||
274 | + } | ||
275 | + sb.append(Integer.toHexString(bt)); | ||
276 | +} | ||
277 | +String md5 = sb.toString(); | ||
278 | + | ||
279 | + | ||
280 | +vars.put("searchValue",req+"&client_secret="+md5);</stringProp> | ||
281 | + </BeanShellPreProcessor> | ||
282 | + <hashTree/> | ||
283 | + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true"> | ||
284 | + <collectionProp name="Asserion.test_strings"> | ||
285 | + <stringProp name="1450572480">"code":200</stringProp> | ||
286 | + </collectionProp> | ||
287 | + <stringProp name="TestPlan.comments"></stringProp> | ||
288 | + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> | ||
289 | + <boolProp name="Assertion.assume_success">false</boolProp> | ||
290 | + <intProp name="Assertion.test_type">16</intProp> | ||
291 | + </ResponseAssertion> | ||
292 | + <hashTree/> | ||
293 | + </hashTree> | ||
294 | + <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="固定TPM" enabled="true"> | ||
295 | + <stringProp name="TestPlan.comments"></stringProp> | ||
296 | + <doubleProp> | ||
297 | + <name>throughput</name> | ||
298 | + <value>120000</value> | ||
299 | + <savedValue>0.0</savedValue> | ||
300 | + </doubleProp> | ||
301 | + <intProp name="calcMode">2</intProp> | ||
302 | + </ConstantThroughputTimer> | ||
303 | + <hashTree/> | ||
304 | + </hashTree> | ||
305 | + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="tg_app_shop_banner" enabled="true"> | ||
306 | + <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | ||
307 | + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true"> | ||
308 | + <boolProp name="LoopController.continue_forever">false</boolProp> | ||
309 | + <intProp name="LoopController.loops">-1</intProp> | ||
310 | + </elementProp> | ||
311 | + <stringProp name="ThreadGroup.num_threads">100</stringProp> | ||
312 | + <stringProp name="ThreadGroup.ramp_time">10</stringProp> | ||
313 | + <longProp name="ThreadGroup.start_time">1488865571000</longProp> | ||
314 | + <longProp name="ThreadGroup.end_time">1488865571000</longProp> | ||
315 | + <boolProp name="ThreadGroup.scheduler">false</boolProp> | ||
316 | + <stringProp name="ThreadGroup.duration"></stringProp> | ||
317 | + <stringProp name="ThreadGroup.delay"></stringProp> | ||
318 | + <stringProp name="TestPlan.comments">店铺banner</stringProp> | ||
319 | + </ThreadGroup> | ||
320 | + <hashTree> | ||
321 | + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tc_app_shop_banner" enabled="true"> | ||
322 | + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> | ||
323 | + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> | ||
324 | + <collectionProp name="Arguments.arguments"> | ||
325 | + <elementProp name="" elementType="HTTPArgument"> | ||
326 | + <boolProp name="HTTPArgument.always_encode">false</boolProp> | ||
327 | + <stringProp name="Argument.value"></stringProp> | ||
328 | + <stringProp name="Argument.metadata">=</stringProp> | ||
329 | + </elementProp> | ||
330 | + </collectionProp> | ||
331 | + </elementProp> | ||
332 | + <stringProp name="HTTPSampler.domain"></stringProp> | ||
333 | + <stringProp name="HTTPSampler.port"></stringProp> | ||
334 | + <stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
335 | + <stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
336 | + <stringProp name="HTTPSampler.protocol"></stringProp> | ||
337 | + <stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
338 | + <stringProp name="HTTPSampler.path">http://${HOST_API}/?${searchValue}</stringProp> | ||
339 | + <stringProp name="HTTPSampler.method">GET</stringProp> | ||
340 | + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
341 | + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
342 | + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
343 | + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
344 | + <boolProp name="HTTPSampler.monitor">false</boolProp> | ||
345 | + <stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
346 | + <stringProp name="TestPlan.comments">店铺banner</stringProp> | ||
347 | + </HTTPSamplerProxy> | ||
348 | + <hashTree> | ||
349 | + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="前置BeanShell" enabled="true"> | ||
350 | + <stringProp name="TestPlan.comments"></stringProp> | ||
351 | + <boolProp name="resetInterpreter">false</boolProp> | ||
352 | + <stringProp name="parameters">${shop_id}</stringProp> | ||
353 | + <stringProp name="filename"></stringProp> | ||
354 | + <stringProp name="script">import java.security.MessageDigest; | ||
355 | +import java.util.Random; | ||
356 | +String[] clientTypes = {"android"}; | ||
357 | +String[] privateKeys = {"fd4ad5fcfa0de589ef238c0e7331b585"}; | ||
358 | +int rd = new Random().nextInt(1); | ||
359 | +String clientType = clientTypes[rd]; | ||
360 | +String privateKey = privateKeys[rd]; | ||
361 | + | ||
362 | +String req = "app_version=5.8.0&client_type="+clientType+"&method=app.shop.banner&os_version=yohobuy:web&private_key="+privateKey+"&screen_size=720x1280&shop_id="+bsh.args[0]+"&v=7"; | ||
363 | +MessageDigest md = MessageDigest.getInstance("MD5"); | ||
364 | +byte[] btInput = req.getBytes(); | ||
365 | +md.update(btInput); | ||
366 | +byte[] btResult = md.digest(); | ||
367 | +StringBuffer sb = new StringBuffer(); | ||
368 | +for(byte b : btResult){ | ||
369 | + int bt = b&0xff; | ||
370 | + if(bt<16){ | ||
371 | + sb.append(0); | ||
372 | + } | ||
373 | + sb.append(Integer.toHexString(bt)); | ||
374 | +} | ||
375 | +String md5 = sb.toString(); | ||
376 | + | ||
377 | + | ||
378 | +vars.put("searchValue",req+"&client_secret="+md5);</stringProp> | ||
379 | + </BeanShellPreProcessor> | ||
380 | + <hashTree/> | ||
381 | + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true"> | ||
382 | + <collectionProp name="Asserion.test_strings"> | ||
383 | + <stringProp name="1450572480">"code":200</stringProp> | ||
384 | + </collectionProp> | ||
385 | + <stringProp name="TestPlan.comments"></stringProp> | ||
386 | + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> | ||
387 | + <boolProp name="Assertion.assume_success">false</boolProp> | ||
388 | + <intProp name="Assertion.test_type">16</intProp> | ||
389 | + </ResponseAssertion> | ||
390 | + <hashTree/> | ||
391 | + </hashTree> | ||
392 | + <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="固定TPM" enabled="true"> | ||
393 | + <stringProp name="TestPlan.comments"></stringProp> | ||
394 | + <doubleProp> | ||
395 | + <name>throughput</name> | ||
396 | + <value>120000</value> | ||
397 | + <savedValue>0.0</savedValue> | ||
398 | + </doubleProp> | ||
399 | + <intProp name="calcMode">2</intProp> | ||
400 | + </ConstantThroughputTimer> | ||
401 | + <hashTree/> | ||
402 | + </hashTree> | ||
403 | + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="tg_shop_coupons_list" enabled="true"> | ||
404 | + <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | ||
405 | + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true"> | ||
406 | + <boolProp name="LoopController.continue_forever">false</boolProp> | ||
407 | + <intProp name="LoopController.loops">-1</intProp> | ||
408 | + </elementProp> | ||
409 | + <stringProp name="ThreadGroup.num_threads">100</stringProp> | ||
410 | + <stringProp name="ThreadGroup.ramp_time">10</stringProp> | ||
411 | + <longProp name="ThreadGroup.start_time">1488865571000</longProp> | ||
412 | + <longProp name="ThreadGroup.end_time">1488865571000</longProp> | ||
413 | + <boolProp name="ThreadGroup.scheduler">false</boolProp> | ||
414 | + <stringProp name="ThreadGroup.duration"></stringProp> | ||
415 | + <stringProp name="ThreadGroup.delay"></stringProp> | ||
416 | + <stringProp name="TestPlan.comments">店铺券列表</stringProp> | ||
417 | + </ThreadGroup> | ||
418 | + <hashTree> | ||
419 | + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tc_shop_coupons_list" enabled="true"> | ||
420 | + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> | ||
421 | + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> | ||
422 | + <collectionProp name="Arguments.arguments"> | ||
423 | + <elementProp name="" elementType="HTTPArgument"> | ||
424 | + <boolProp name="HTTPArgument.always_encode">false</boolProp> | ||
425 | + <stringProp name="Argument.value"></stringProp> | ||
426 | + <stringProp name="Argument.metadata">=</stringProp> | ||
427 | + </elementProp> | ||
428 | + </collectionProp> | ||
429 | + </elementProp> | ||
430 | + <stringProp name="HTTPSampler.domain"></stringProp> | ||
431 | + <stringProp name="HTTPSampler.port"></stringProp> | ||
432 | + <stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
433 | + <stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
434 | + <stringProp name="HTTPSampler.protocol"></stringProp> | ||
435 | + <stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
436 | + <stringProp name="HTTPSampler.path">http://${HOST_API}/?${searchValue}</stringProp> | ||
437 | + <stringProp name="HTTPSampler.method">GET</stringProp> | ||
438 | + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
439 | + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
440 | + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
441 | + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
442 | + <boolProp name="HTTPSampler.monitor">false</boolProp> | ||
443 | + <stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
444 | + <stringProp name="TestPlan.comments">店铺券列表</stringProp> | ||
445 | + </HTTPSamplerProxy> | ||
446 | + <hashTree> | ||
447 | + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="前置BeanShell" enabled="true"> | ||
448 | + <stringProp name="TestPlan.comments"></stringProp> | ||
449 | + <boolProp name="resetInterpreter">false</boolProp> | ||
450 | + <stringProp name="parameters">${shop_id} ${uid}</stringProp> | ||
451 | + <stringProp name="filename"></stringProp> | ||
452 | + <stringProp name="script">import java.security.MessageDigest; | ||
453 | +import java.util.Random; | ||
454 | +String[] clientTypes = {"android"}; | ||
455 | +String[] privateKeys = {"fd4ad5fcfa0de589ef238c0e7331b585"}; | ||
456 | +int rd = new Random().nextInt(1); | ||
457 | +String clientType = clientTypes[rd]; | ||
458 | +String privateKey = privateKeys[rd]; | ||
459 | + | ||
460 | +String req = "app_version=5.8.1&client_type="+clientType+"&method=shop.coupons.list&os_version=10.1&physical_channel=1&private_key="+privateKey+"&screen_size=320x480&session_key=d4632b4a5ce11f5c55fd1e7c5b3ef286&shop_id="+bsh.args[0]+"&udid=f22afbf8d79589d2b33ec431804014344f8305ef&uid="+bsh.args[1]+"&v=7"; | ||
461 | +MessageDigest md = MessageDigest.getInstance("MD5"); | ||
462 | +byte[] btInput = req.getBytes(); | ||
463 | +md.update(btInput); | ||
464 | +byte[] btResult = md.digest(); | ||
465 | +StringBuffer sb = new StringBuffer(); | ||
466 | +for(byte b : btResult){ | ||
467 | + int bt = b&0xff; | ||
468 | + if(bt<16){ | ||
469 | + sb.append(0); | ||
470 | + } | ||
471 | + sb.append(Integer.toHexString(bt)); | ||
472 | +} | ||
473 | +String md5 = sb.toString(); | ||
474 | + | ||
475 | + | ||
476 | +vars.put("searchValue",req+"&client_secret="+md5);</stringProp> | ||
477 | + </BeanShellPreProcessor> | ||
478 | + <hashTree/> | ||
479 | + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true"> | ||
480 | + <collectionProp name="Asserion.test_strings"> | ||
481 | + <stringProp name="1450572480">"code":200</stringProp> | ||
482 | + </collectionProp> | ||
483 | + <stringProp name="TestPlan.comments"></stringProp> | ||
484 | + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> | ||
485 | + <boolProp name="Assertion.assume_success">false</boolProp> | ||
486 | + <intProp name="Assertion.test_type">16</intProp> | ||
487 | + </ResponseAssertion> | ||
488 | + <hashTree/> | ||
489 | + </hashTree> | ||
490 | + <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="固定TPM" enabled="true"> | ||
491 | + <stringProp name="TestPlan.comments"></stringProp> | ||
492 | + <doubleProp> | ||
493 | + <name>throughput</name> | ||
494 | + <value>120000</value> | ||
495 | + <savedValue>0.0</savedValue> | ||
496 | + </doubleProp> | ||
497 | + <intProp name="calcMode">2</intProp> | ||
498 | + </ConstantThroughputTimer> | ||
499 | + <hashTree/> | ||
500 | + </hashTree> | ||
501 | + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="tg_app_shopsdecorator_getList" enabled="true"> | ||
502 | + <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | ||
503 | + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true"> | ||
504 | + <boolProp name="LoopController.continue_forever">false</boolProp> | ||
505 | + <intProp name="LoopController.loops">-1</intProp> | ||
506 | + </elementProp> | ||
507 | + <stringProp name="ThreadGroup.num_threads">100</stringProp> | ||
508 | + <stringProp name="ThreadGroup.ramp_time">10</stringProp> | ||
509 | + <longProp name="ThreadGroup.start_time">1488865571000</longProp> | ||
510 | + <longProp name="ThreadGroup.end_time">1488865571000</longProp> | ||
511 | + <boolProp name="ThreadGroup.scheduler">false</boolProp> | ||
512 | + <stringProp name="ThreadGroup.duration"></stringProp> | ||
513 | + <stringProp name="ThreadGroup.delay"></stringProp> | ||
514 | + <stringProp name="TestPlan.comments">店铺资源位数据(人气商品等)</stringProp> | ||
515 | + </ThreadGroup> | ||
516 | + <hashTree> | ||
517 | + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tc_app_shopsdecorator_getList" enabled="true"> | ||
518 | + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> | ||
519 | + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> | ||
520 | + <collectionProp name="Arguments.arguments"> | ||
521 | + <elementProp name="" elementType="HTTPArgument"> | ||
522 | + <boolProp name="HTTPArgument.always_encode">false</boolProp> | ||
523 | + <stringProp name="Argument.value"></stringProp> | ||
524 | + <stringProp name="Argument.metadata">=</stringProp> | ||
525 | + </elementProp> | ||
526 | + </collectionProp> | ||
527 | + </elementProp> | ||
528 | + <stringProp name="HTTPSampler.domain"></stringProp> | ||
529 | + <stringProp name="HTTPSampler.port"></stringProp> | ||
530 | + <stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
531 | + <stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
532 | + <stringProp name="HTTPSampler.protocol"></stringProp> | ||
533 | + <stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
534 | + <stringProp name="HTTPSampler.path">http://${HOST_API}/?${searchValue}</stringProp> | ||
535 | + <stringProp name="HTTPSampler.method">GET</stringProp> | ||
536 | + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
537 | + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
538 | + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
539 | + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
540 | + <boolProp name="HTTPSampler.monitor">false</boolProp> | ||
541 | + <stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
542 | + <stringProp name="TestPlan.comments">店铺资源位数据(人气商品等)</stringProp> | ||
543 | + </HTTPSamplerProxy> | ||
544 | + <hashTree> | ||
545 | + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="前置BeanShell" enabled="true"> | ||
546 | + <stringProp name="TestPlan.comments"></stringProp> | ||
547 | + <boolProp name="resetInterpreter">false</boolProp> | ||
548 | + <stringProp name="parameters">${shop_id}</stringProp> | ||
549 | + <stringProp name="filename"></stringProp> | ||
550 | + <stringProp name="script">import java.security.MessageDigest; | ||
551 | +import java.util.Random; | ||
552 | +String[] clientTypes = {"android"}; | ||
553 | +String[] privateKeys = {"fd4ad5fcfa0de589ef238c0e7331b585"}; | ||
554 | +int rd = new Random().nextInt(1); | ||
555 | +String clientType = clientTypes[rd]; | ||
556 | +String privateKey = privateKeys[rd]; | ||
557 | + | ||
558 | +String req = "app_version=5.8.0&client_type="+clientType+"&method=app.shopsdecorator.getList&os_version=yohobuy:web&private_key="+privateKey+"&screen_size=720x1280&shop_id="+bsh.args[0]+"&v=7"; | ||
559 | +MessageDigest md = MessageDigest.getInstance("MD5"); | ||
560 | +byte[] btInput = req.getBytes(); | ||
561 | +md.update(btInput); | ||
562 | +byte[] btResult = md.digest(); | ||
563 | +StringBuffer sb = new StringBuffer(); | ||
564 | +for(byte b : btResult){ | ||
565 | + int bt = b&0xff; | ||
566 | + if(bt<16){ | ||
567 | + sb.append(0); | ||
568 | + } | ||
569 | + sb.append(Integer.toHexString(bt)); | ||
570 | +} | ||
571 | +String md5 = sb.toString(); | ||
572 | + | ||
573 | + | ||
574 | +vars.put("searchValue",req+"&client_secret="+md5);</stringProp> | ||
575 | + </BeanShellPreProcessor> | ||
576 | + <hashTree/> | ||
577 | + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true"> | ||
578 | + <collectionProp name="Asserion.test_strings"> | ||
579 | + <stringProp name="1450572480">"code":200</stringProp> | ||
580 | + </collectionProp> | ||
581 | + <stringProp name="TestPlan.comments"></stringProp> | ||
582 | + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> | ||
583 | + <boolProp name="Assertion.assume_success">false</boolProp> | ||
584 | + <intProp name="Assertion.test_type">16</intProp> | ||
585 | + </ResponseAssertion> | ||
586 | + <hashTree/> | ||
587 | + </hashTree> | ||
588 | + <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="固定TPM" enabled="true"> | ||
589 | + <stringProp name="TestPlan.comments"></stringProp> | ||
590 | + <doubleProp> | ||
591 | + <name>throughput</name> | ||
592 | + <value>120000</value> | ||
593 | + <savedValue>0.0</savedValue> | ||
594 | + </doubleProp> | ||
595 | + <intProp name="calcMode">2</intProp> | ||
596 | + </ConstantThroughputTimer> | ||
597 | + <hashTree/> | ||
598 | + </hashTree> | ||
599 | + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="tg_app_shop_getSortInfo" enabled="true"> | ||
600 | + <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | ||
601 | + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true"> | ||
602 | + <boolProp name="LoopController.continue_forever">false</boolProp> | ||
603 | + <intProp name="LoopController.loops">-1</intProp> | ||
604 | + </elementProp> | ||
605 | + <stringProp name="ThreadGroup.num_threads">100</stringProp> | ||
606 | + <stringProp name="ThreadGroup.ramp_time">10</stringProp> | ||
607 | + <longProp name="ThreadGroup.start_time">1488865571000</longProp> | ||
608 | + <longProp name="ThreadGroup.end_time">1488865571000</longProp> | ||
609 | + <boolProp name="ThreadGroup.scheduler">false</boolProp> | ||
610 | + <stringProp name="ThreadGroup.duration"></stringProp> | ||
611 | + <stringProp name="ThreadGroup.delay"></stringProp> | ||
612 | + <stringProp name="TestPlan.comments">获取分类</stringProp> | ||
613 | + </ThreadGroup> | ||
614 | + <hashTree> | ||
615 | + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tc_app_shop_getSortInfo" enabled="true"> | ||
616 | + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> | ||
617 | + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> | ||
618 | + <collectionProp name="Arguments.arguments"> | ||
619 | + <elementProp name="" elementType="HTTPArgument"> | ||
620 | + <boolProp name="HTTPArgument.always_encode">false</boolProp> | ||
621 | + <stringProp name="Argument.value"></stringProp> | ||
622 | + <stringProp name="Argument.metadata">=</stringProp> | ||
623 | + </elementProp> | ||
624 | + </collectionProp> | ||
625 | + </elementProp> | ||
626 | + <stringProp name="HTTPSampler.domain"></stringProp> | ||
627 | + <stringProp name="HTTPSampler.port"></stringProp> | ||
628 | + <stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
629 | + <stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
630 | + <stringProp name="HTTPSampler.protocol"></stringProp> | ||
631 | + <stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
632 | + <stringProp name="HTTPSampler.path">http://${HOST_API}/?${searchValue}</stringProp> | ||
633 | + <stringProp name="HTTPSampler.method">GET</stringProp> | ||
634 | + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
635 | + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
636 | + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
637 | + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
638 | + <boolProp name="HTTPSampler.monitor">false</boolProp> | ||
639 | + <stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
640 | + <stringProp name="TestPlan.comments">获取分类</stringProp> | ||
641 | + </HTTPSamplerProxy> | ||
642 | + <hashTree> | ||
643 | + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="前置BeanShell" enabled="true"> | ||
644 | + <stringProp name="TestPlan.comments"></stringProp> | ||
645 | + <boolProp name="resetInterpreter">false</boolProp> | ||
646 | + <stringProp name="parameters">${shop_id} ${uid}</stringProp> | ||
255 | <stringProp name="filename"></stringProp> | 647 | <stringProp name="filename"></stringProp> |
256 | <stringProp name="script">import java.security.MessageDigest; | 648 | <stringProp name="script">import java.security.MessageDigest; |
257 | import java.util.Random; | 649 | import java.util.Random; |
@@ -260,7 +652,8 @@ String[] privateKeys = {"fd4ad5fcfa0de589ef238c0e7331b585"}; | @@ -260,7 +652,8 @@ String[] privateKeys = {"fd4ad5fcfa0de589ef238c0e7331b585"}; | ||
260 | int rd = new Random().nextInt(1); | 652 | int rd = new Random().nextInt(1); |
261 | String clientType = clientTypes[rd]; | 653 | String clientType = clientTypes[rd]; |
262 | String privateKey = privateKeys[rd]; | 654 | String privateKey = privateKeys[rd]; |
263 | -String req = "app_version=5.8.0&client_type="+clientType+"&is_support_mlp=Y&method=app.Shopping.queryCart&os_version=yohobuy:web&private_key="+privateKey+"&screen_size=720x1280&session_key=3b3af315f8ee63ba511d596496dabd39&shopping_key="+bsh.args[0]+"&uid="+bsh.args[1]+"&v=7"; | 655 | + |
656 | +String req = "app_version=5.8.1&client_type="+clientType+"&fromPage=iFP_StoreMain&method=app.shop.getSortInfo&os_version=10.3.2&physical_channel=1&private_key="+privateKey+"&screen_size=375x667&session_key=627e94460fce9b66e247ebd061fb36f9&shop_id="+bsh.args[0]+"&udid=9561cd2262d04577127d43b483232a2f745dc25b&uid="+bsh.args[1]+"&v=7&yh_channel=1"; | ||
264 | MessageDigest md = MessageDigest.getInstance("MD5"); | 657 | MessageDigest md = MessageDigest.getInstance("MD5"); |
265 | byte[] btInput = req.getBytes(); | 658 | byte[] btInput = req.getBytes(); |
266 | md.update(btInput); | 659 | md.update(btInput); |
@@ -274,6 +667,8 @@ for(byte b : btResult){ | @@ -274,6 +667,8 @@ for(byte b : btResult){ | ||
274 | sb.append(Integer.toHexString(bt)); | 667 | sb.append(Integer.toHexString(bt)); |
275 | } | 668 | } |
276 | String md5 = sb.toString(); | 669 | String md5 = sb.toString(); |
670 | + | ||
671 | + | ||
277 | vars.put("searchValue",req+"&client_secret="+md5);</stringProp> | 672 | vars.put("searchValue",req+"&client_secret="+md5);</stringProp> |
278 | </BeanShellPreProcessor> | 673 | </BeanShellPreProcessor> |
279 | <hashTree/> | 674 | <hashTree/> |
-
Please register or login to post a comment