Showing
1 changed file
with
72 additions
and
1 deletions
@@ -463,12 +463,83 @@ vars.put("searchValue",req+"&client_secret="+md5);</stri | @@ -463,12 +463,83 @@ vars.put("searchValue",req+"&client_secret="+md5);</stri | ||
463 | </ResponseAssertion> | 463 | </ResponseAssertion> |
464 | <hashTree/> | 464 | <hashTree/> |
465 | </hashTree> | 465 | </hashTree> |
466 | + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="child_tc_app_ShoppingForOffline_remove" enabled="true"> | ||
467 | + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> | ||
468 | + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> | ||
469 | + <collectionProp name="Arguments.arguments"> | ||
470 | + <elementProp name="" elementType="HTTPArgument"> | ||
471 | + <boolProp name="HTTPArgument.always_encode">false</boolProp> | ||
472 | + <stringProp name="Argument.value"></stringProp> | ||
473 | + <stringProp name="Argument.metadata">=</stringProp> | ||
474 | + </elementProp> | ||
475 | + </collectionProp> | ||
476 | + </elementProp> | ||
477 | + <stringProp name="HTTPSampler.domain"></stringProp> | ||
478 | + <stringProp name="HTTPSampler.port"></stringProp> | ||
479 | + <stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
480 | + <stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
481 | + <stringProp name="HTTPSampler.protocol"></stringProp> | ||
482 | + <stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
483 | + <stringProp name="HTTPSampler.path">http://${HOST_API}/?${searchValue}</stringProp> | ||
484 | + <stringProp name="HTTPSampler.method">GET</stringProp> | ||
485 | + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
486 | + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
487 | + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
488 | + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
489 | + <boolProp name="HTTPSampler.monitor">false</boolProp> | ||
490 | + <stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
491 | + <stringProp name="TestPlan.comments"></stringProp> | ||
492 | + </HTTPSamplerProxy> | ||
493 | + <hashTree> | ||
494 | + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="前置BeanShell" enabled="true"> | ||
495 | + <stringProp name="TestPlan.comments"></stringProp> | ||
496 | + <boolProp name="resetInterpreter">false</boolProp> | ||
497 | + <stringProp name="parameters">${offline_uid} ${offline_product_sku} ${offline_shopping_key} ${offline_warehouse_id}</stringProp> | ||
498 | + <stringProp name="filename"></stringProp> | ||
499 | + <stringProp name="script">import java.security.MessageDigest; | ||
500 | +import java.util.Random; | ||
501 | +String[] clientTypes = {"android"}; | ||
502 | +String[] privateKeys = {"fd4ad5fcfa0de589ef238c0e7331b585"}; | ||
503 | +int rd = new Random().nextInt(1); | ||
504 | +String clientType = clientTypes[rd]; | ||
505 | +String privateKey = privateKeys[rd]; | ||
506 | +String product_sku_list = "[{\"buy_number\":\"1\",\"product_sku\":\""+bsh.args[1]+"\",\"buy_type\":\"1\"}]"; | ||
507 | +String req = "app_version=5.6.0&client_type="+clientType+"&employee_uid="+bsh.args[0]+"&method=app.ShoppingForOffline.remove&os_version=10.3.1&private_key="+privateKey+"&product_sku_list="+product_sku_list+"&promotion_id=0&screen_size=768x1024&session_key=2a557208e3537f112685015c36e4e58e&shopping_key="+bsh.args[2]+"&v=7&warehouse_id="+bsh.args[3]+""; | ||
508 | +MessageDigest md = MessageDigest.getInstance("MD5"); | ||
509 | +byte[] btInput = req.getBytes(); | ||
510 | +md.update(btInput); | ||
511 | +byte[] btResult = md.digest(); | ||
512 | +StringBuffer sb = new StringBuffer(); | ||
513 | +for(byte b : btResult){ | ||
514 | + int bt = b&0xff; | ||
515 | + if(bt<16){ | ||
516 | + sb.append(0); | ||
517 | + } | ||
518 | + sb.append(Integer.toHexString(bt)); | ||
519 | +} | ||
520 | +String md5 = sb.toString(); | ||
521 | +product_sku_list=URLEncoder.encode(product_sku_list); | ||
522 | +req = "app_version=5.6.0&client_type="+clientType+"&employee_uid="+bsh.args[0]+"&method=app.ShoppingForOffline.remove&os_version=10.3.1&private_key="+privateKey+"&product_sku_list="+product_sku_list+"&promotion_id=0&screen_size=768x1024&session_key=2a557208e3537f112685015c36e4e58e&shopping_key="+bsh.args[2]+"&v=7&warehouse_id="+bsh.args[3]+""; | ||
523 | +vars.put("searchValue",req+"&client_secret="+md5);</stringProp> | ||
524 | + </BeanShellPreProcessor> | ||
525 | + <hashTree/> | ||
526 | + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true"> | ||
527 | + <collectionProp name="Asserion.test_strings"> | ||
528 | + <stringProp name="1450572480">"code":200</stringProp> | ||
529 | + </collectionProp> | ||
530 | + <stringProp name="TestPlan.comments"></stringProp> | ||
531 | + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> | ||
532 | + <boolProp name="Assertion.assume_success">false</boolProp> | ||
533 | + <intProp name="Assertion.test_type">16</intProp> | ||
534 | + </ResponseAssertion> | ||
535 | + <hashTree/> | ||
536 | + </hashTree> | ||
466 | </hashTree> | 537 | </hashTree> |
467 | <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="固定TPM" enabled="true"> | 538 | <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="固定TPM" enabled="true"> |
468 | <stringProp name="TestPlan.comments"></stringProp> | 539 | <stringProp name="TestPlan.comments"></stringProp> |
469 | <doubleProp> | 540 | <doubleProp> |
470 | <name>throughput</name> | 541 | <name>throughput</name> |
471 | - <value>3000</value> | 542 | + <value>3600</value> |
472 | <savedValue>0.0</savedValue> | 543 | <savedValue>0.0</savedValue> |
473 | </doubleProp> | 544 | </doubleProp> |
474 | <intProp name="calcMode">2</intProp> | 545 | <intProp name="calcMode">2</intProp> |
-
Please register or login to post a comment