Showing
1 changed file
with
98 additions
and
0 deletions
@@ -314,6 +314,104 @@ vars.put("searchValue",req+"&client_secret="+md5);</stri | @@ -314,6 +314,104 @@ vars.put("searchValue",req+"&client_secret="+md5);</stri | ||
314 | </ConstantThroughputTimer> | 314 | </ConstantThroughputTimer> |
315 | <hashTree/> | 315 | <hashTree/> |
316 | </hashTree> | 316 | </hashTree> |
317 | + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="tg_app_activity_template" enabled="true"> | ||
318 | + <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | ||
319 | + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true"> | ||
320 | + <boolProp name="LoopController.continue_forever">false</boolProp> | ||
321 | + <intProp name="LoopController.loops">-1</intProp> | ||
322 | + </elementProp> | ||
323 | + <stringProp name="ThreadGroup.num_threads">100</stringProp> | ||
324 | + <stringProp name="ThreadGroup.ramp_time">10</stringProp> | ||
325 | + <longProp name="ThreadGroup.start_time">1488865571000</longProp> | ||
326 | + <longProp name="ThreadGroup.end_time">1488865571000</longProp> | ||
327 | + <boolProp name="ThreadGroup.scheduler">false</boolProp> | ||
328 | + <stringProp name="ThreadGroup.duration"></stringProp> | ||
329 | + <stringProp name="ThreadGroup.delay"></stringProp> | ||
330 | + <stringProp name="TestPlan.comments">活动模版</stringProp> | ||
331 | + </ThreadGroup> | ||
332 | + <hashTree> | ||
333 | + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tc_app_activity_template" enabled="true"> | ||
334 | + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> | ||
335 | + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> | ||
336 | + <collectionProp name="Arguments.arguments"> | ||
337 | + <elementProp name="" elementType="HTTPArgument"> | ||
338 | + <boolProp name="HTTPArgument.always_encode">false</boolProp> | ||
339 | + <stringProp name="Argument.value"></stringProp> | ||
340 | + <stringProp name="Argument.metadata">=</stringProp> | ||
341 | + </elementProp> | ||
342 | + </collectionProp> | ||
343 | + </elementProp> | ||
344 | + <stringProp name="HTTPSampler.domain"></stringProp> | ||
345 | + <stringProp name="HTTPSampler.port"></stringProp> | ||
346 | + <stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
347 | + <stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
348 | + <stringProp name="HTTPSampler.protocol"></stringProp> | ||
349 | + <stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
350 | + <stringProp name="HTTPSampler.path">http://${HOST_API}/?${searchValue}</stringProp> | ||
351 | + <stringProp name="HTTPSampler.method">GET</stringProp> | ||
352 | + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
353 | + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
354 | + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
355 | + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
356 | + <boolProp name="HTTPSampler.monitor">false</boolProp> | ||
357 | + <stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
358 | + <stringProp name="TestPlan.comments">活动模版</stringProp> | ||
359 | + </HTTPSamplerProxy> | ||
360 | + <hashTree> | ||
361 | + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="前置BeanShell" enabled="true"> | ||
362 | + <stringProp name="TestPlan.comments"></stringProp> | ||
363 | + <boolProp name="resetInterpreter">false</boolProp> | ||
364 | + <stringProp name="parameters"></stringProp> | ||
365 | + <stringProp name="filename"></stringProp> | ||
366 | + <stringProp name="script">import java.security.MessageDigest; | ||
367 | +import java.util.Random; | ||
368 | +String[] clientTypes = {"android","iphone"}; | ||
369 | +String[] privateKeys = {"fd4ad5fcfa0de589ef238c0e7331b585","a85bb0674e08986c6b115d5e3a4884fa"}; | ||
370 | +int rd = new Random().nextInt(2); | ||
371 | +String clientType = clientTypes[rd]; | ||
372 | +String privateKey = privateKeys[rd]; | ||
373 | +String os_version = "yohobuy:h5"; | ||
374 | +String req = "activity_id=483&app_version=6.0.1&client_type="+clientType+"&method=app.activity.template&os_version="+os_version+"&private_key="+privateKey+"&screen_size=720x1280&v=7"; | ||
375 | +MessageDigest md = MessageDigest.getInstance("MD5"); | ||
376 | +byte[] btInput = req.getBytes(); | ||
377 | +md.update(btInput); | ||
378 | +byte[] btResult = md.digest(); | ||
379 | +StringBuffer sb = new StringBuffer(); | ||
380 | +for(byte b : btResult){ | ||
381 | + int bt = b&0xff; | ||
382 | + if(bt<16){ | ||
383 | + sb.append(0); | ||
384 | + } | ||
385 | + sb.append(Integer.toHexString(bt)); | ||
386 | +} | ||
387 | +String md5 = sb.toString(); | ||
388 | +os_version=URLEncoder.encode(os_version); | ||
389 | +req = "activity_id=483&app_version=6.0.1&client_type="+clientType+"&method=app.activity.template&os_version="+os_version+"&private_key="+privateKey+"&screen_size=720x1280&v=7"; | ||
390 | +vars.put("searchValue",req+"&client_secret="+md5);</stringProp> | ||
391 | + </BeanShellPreProcessor> | ||
392 | + <hashTree/> | ||
393 | + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true"> | ||
394 | + <collectionProp name="Asserion.test_strings"> | ||
395 | + <stringProp name="1450572480">"code":200</stringProp> | ||
396 | + </collectionProp> | ||
397 | + <stringProp name="TestPlan.comments"></stringProp> | ||
398 | + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> | ||
399 | + <boolProp name="Assertion.assume_success">false</boolProp> | ||
400 | + <intProp name="Assertion.test_type">16</intProp> | ||
401 | + </ResponseAssertion> | ||
402 | + <hashTree/> | ||
403 | + </hashTree> | ||
404 | + <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="固定TPM" enabled="true"> | ||
405 | + <stringProp name="TestPlan.comments"></stringProp> | ||
406 | + <doubleProp> | ||
407 | + <name>throughput</name> | ||
408 | + <value>60000</value> | ||
409 | + <savedValue>0.0</savedValue> | ||
410 | + </doubleProp> | ||
411 | + <intProp name="calcMode">2</intProp> | ||
412 | + </ConstantThroughputTimer> | ||
413 | + <hashTree/> | ||
414 | + </hashTree> | ||
317 | <BackendListener guiclass="BackendListenerGui" testclass="BackendListener" testname="influxdb_master" enabled="true"> | 415 | <BackendListener guiclass="BackendListenerGui" testclass="BackendListener" testname="influxdb_master" enabled="true"> |
318 | <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true"> | 416 | <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true"> |
319 | <collectionProp name="Arguments.arguments"> | 417 | <collectionProp name="Arguments.arguments"> |
-
Please register or login to post a comment