Showing
1 changed file
with
56 additions
and
123 deletions
@@ -221,129 +221,62 @@ | @@ -221,129 +221,62 @@ | ||
221 | </HTTPSamplerProxy> | 221 | </HTTPSamplerProxy> |
222 | <hashTree> | 222 | <hashTree> |
223 | </hashTree> | 223 | </hashTree> |
224 | - <RandomController guiclass="RandomControlGui" testclass="RandomController" testname="随机控制器" enabled="true"> | ||
225 | - <intProp name="InterleaveControl.style">1</intProp> | ||
226 | - </RandomController> | ||
227 | - <hashTree> | ||
228 | - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="ajax_1" enabled="true"> | ||
229 | - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> | ||
230 | - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> | ||
231 | - <collectionProp name="Arguments.arguments"> | ||
232 | - <elementProp name="" elementType="HTTPArgument"> | ||
233 | - <boolProp name="HTTPArgument.always_encode">false</boolProp> | ||
234 | - <stringProp name="Argument.value"></stringProp> | ||
235 | - <stringProp name="Argument.metadata">=</stringProp> | ||
236 | - </elementProp> | ||
237 | - </collectionProp> | ||
238 | - </elementProp> | ||
239 | - <stringProp name="HTTPSampler.domain"></stringProp> | ||
240 | - <stringProp name="HTTPSampler.port"></stringProp> | ||
241 | - <stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
242 | - <stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
243 | - <stringProp name="HTTPSampler.protocol"></stringProp> | ||
244 | - <stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
245 | - <stringProp name="HTTPSampler.path">http://${HOST_PC}/common/suggestfeedback?callback=jQuery112407297836417199297_1506394331103&return_type=jsonp&client_secret=web&code=200&_=1506394331104</stringProp> | ||
246 | - <stringProp name="HTTPSampler.method">GET</stringProp> | ||
247 | - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
248 | - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
249 | - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
250 | - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
251 | - <boolProp name="HTTPSampler.monitor">false</boolProp> | ||
252 | - <stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
253 | - <stringProp name="TestPlan.comments">务必以tc_开头,否则无法获取统计结果</stringProp> | ||
254 | - </HTTPSamplerProxy> | ||
255 | - <hashTree> | ||
256 | - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true"> | ||
257 | - <collectionProp name="Asserion.test_strings"> | ||
258 | - <stringProp name="1450572480"></stringProp> | ||
259 | - </collectionProp> | ||
260 | - <stringProp name="TestPlan.comments"></stringProp> | ||
261 | - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> | ||
262 | - <boolProp name="Assertion.assume_success">false</boolProp> | ||
263 | - <intProp name="Assertion.test_type">16</intProp> | ||
264 | - </ResponseAssertion> | ||
265 | - <hashTree/> | ||
266 | - </hashTree> | ||
267 | - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="ajax_2" enabled="true"> | ||
268 | - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> | ||
269 | - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> | ||
270 | - <collectionProp name="Arguments.arguments"> | ||
271 | - <elementProp name="" elementType="HTTPArgument"> | ||
272 | - <boolProp name="HTTPArgument.always_encode">false</boolProp> | ||
273 | - <stringProp name="Argument.value"></stringProp> | ||
274 | - <stringProp name="Argument.metadata">=</stringProp> | ||
275 | - </elementProp> | ||
276 | - </collectionProp> | ||
277 | - </elementProp> | ||
278 | - <stringProp name="HTTPSampler.domain"></stringProp> | ||
279 | - <stringProp name="HTTPSampler.port"></stringProp> | ||
280 | - <stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
281 | - <stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
282 | - <stringProp name="HTTPSampler.protocol"></stringProp> | ||
283 | - <stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
284 | - <stringProp name="HTTPSampler.path">http://${HOST_PC}/guang/info/listData?ids=67249%2C67239%2C67157%2C67191%2C67189%2C67163%2C67161%2C67259%2C67287%2C67159%2C67279%2C67263%2C67113%2C67199%2C67261%2C67143%2C67153%2C67197%2C67141%2C67195&type=0</stringProp> | ||
285 | - <stringProp name="HTTPSampler.method">GET</stringProp> | ||
286 | - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
287 | - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
288 | - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
289 | - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
290 | - <boolProp name="HTTPSampler.monitor">false</boolProp> | ||
291 | - <stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
292 | - <stringProp name="TestPlan.comments">务必以tc_开头,否则无法获取统计结果</stringProp> | ||
293 | - </HTTPSamplerProxy> | ||
294 | - <hashTree> | ||
295 | - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true"> | ||
296 | - <collectionProp name="Asserion.test_strings"> | ||
297 | - <stringProp name="1450572480"></stringProp> | ||
298 | - </collectionProp> | ||
299 | - <stringProp name="TestPlan.comments"></stringProp> | ||
300 | - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> | ||
301 | - <boolProp name="Assertion.assume_success">false</boolProp> | ||
302 | - <intProp name="Assertion.test_type">16</intProp> | ||
303 | - </ResponseAssertion> | ||
304 | - <hashTree/> | ||
305 | - </hashTree> | ||
306 | - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="ajax_3" enabled="true"> | ||
307 | - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> | ||
308 | - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> | ||
309 | - <collectionProp name="Arguments.arguments"> | ||
310 | - <elementProp name="" elementType="HTTPArgument"> | ||
311 | - <boolProp name="HTTPArgument.always_encode">false</boolProp> | ||
312 | - <stringProp name="Argument.value"></stringProp> | ||
313 | - <stringProp name="Argument.metadata">=</stringProp> | ||
314 | - </elementProp> | ||
315 | - </collectionProp> | ||
316 | - </elementProp> | ||
317 | - <stringProp name="HTTPSampler.domain"></stringProp> | ||
318 | - <stringProp name="HTTPSampler.port"></stringProp> | ||
319 | - <stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
320 | - <stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
321 | - <stringProp name="HTTPSampler.protocol"></stringProp> | ||
322 | - <stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
323 | - <stringProp name="HTTPSampler.path">http://${HOST_PC}/passport/cert/headerTip?callback=jQuery112407297836417199297_1506394331103&_=1506394331105</stringProp> | ||
324 | - <stringProp name="HTTPSampler.method">GET</stringProp> | ||
325 | - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
326 | - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
327 | - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
328 | - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
329 | - <boolProp name="HTTPSampler.monitor">false</boolProp> | ||
330 | - <stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
331 | - <stringProp name="TestPlan.comments">务必以tc_开头,否则无法获取统计结果</stringProp> | ||
332 | - </HTTPSamplerProxy> | ||
333 | - <hashTree> | ||
334 | - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true"> | ||
335 | - <collectionProp name="Asserion.test_strings"> | ||
336 | - <stringProp name="1450572480"></stringProp> | ||
337 | - </collectionProp> | ||
338 | - <stringProp name="TestPlan.comments"></stringProp> | ||
339 | - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> | ||
340 | - <boolProp name="Assertion.assume_success">false</boolProp> | ||
341 | - <intProp name="Assertion.test_type">16</intProp> | ||
342 | - </ResponseAssertion> | ||
343 | - <hashTree/> | ||
344 | - </hashTree> | ||
345 | - </hashTree> | ||
346 | - </hashTree> | 224 | +<JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler" enabled="true"> |
225 | + <stringProp name="cacheKey">b04922f8-efaa-4390-bc5f-df25d02450bb</stringProp> | ||
226 | + <stringProp name="filename"></stringProp> | ||
227 | + <stringProp name="parameters">GEThttp://${HOST_PC}/common/suggestfeedback?callback=jQuery112407297836417199297_1506394331103&return_type=jsonp&client_secret=web&code=200&_=1506394331104 GEThttp://${HOST_PC}/guang/info/listData?ids=67249%2C67239%2C67157%2C67191%2C67189%2C67163%2C67161%2C67259%2C67287%2C67159%2C67279%2C67263%2C67113%2C67199%2C67261%2C67143%2C67153%2C67197%2C67141%2C67195&type=0 GEThttp://${HOST_PC}/passport/cert/headerTip?callback=jQuery112407297836417199297_1506394331103&_=1506394331105</stringProp> | ||
228 | + <stringProp name="script">import org.apache.http.HttpEntity; | ||
229 | +import org.apache.http.HttpResponse; | ||
230 | +import org.apache.http.client.HttpClient; | ||
231 | +import org.apache.http.client.methods.HttpGet; | ||
232 | +import org.apache.http.client.methods.HttpPost; | ||
233 | +import org.apache.http.impl.client.DefaultHttpClient; | ||
234 | +import org.apache.http.util.EntityUtils; | ||
235 | + | ||
236 | +import java.util.ArrayList; | ||
237 | +import java.util.List; | ||
238 | +import java.util.concurrent.ExecutorService; | ||
239 | +import java.util.concurrent.Executors; | ||
240 | +List<String> urls = new ArrayList<String>(); | ||
241 | +Collections.addAll(urls,args); | ||
242 | +ExecutorService pool = Executors.newFixedThreadPool(urls.size()); | ||
243 | +for (String url : urls) { | ||
244 | + final String currentURL = url; | ||
245 | + pool.submit(new Runnable() { | ||
246 | + @Override | ||
247 | + public void run() { | ||
248 | + try { | ||
249 | + if(currentURL.startsWith("GET")){ | ||
250 | + currentURL=currentURL.substring(3); | ||
251 | + HttpClient client = new DefaultHttpClient(); | ||
252 | + HttpGet get = new HttpGet(currentURL); | ||
253 | + HttpResponse response = client.execute(get); | ||
254 | + HttpEntity entity = response.getEntity(); | ||
255 | + EntityUtils.consume(entity); | ||
256 | + } | ||
257 | + if(currentURL.startsWith("POST")){ | ||
258 | + String[] splitArr =currentURL.substring(4).split("YptPostData="); | ||
259 | + currentURL = splitArr[0]; | ||
260 | + String postData = splitArr[1]; | ||
261 | + HttpClient client = new DefaultHttpClient(); | ||
262 | + HttpPost post = new HttpPost(currentURL); | ||
263 | + StringEntity entity = new StringEntity(postData, Charset.forName("UTF-8")); | ||
264 | + entity.setContentEncoding("UTF-8"); | ||
265 | + post.setEntity(entity); | ||
266 | + HttpResponse response = client.execute(post); | ||
267 | + HttpEntity entity = response.getEntity(); | ||
268 | + EntityUtils.consume(entity); | ||
269 | + } | ||
270 | + }catch (Exception ex) { | ||
271 | + ex.printStackTrace(); | ||
272 | + } | ||
273 | + } | ||
274 | + }); | ||
275 | +} | ||
276 | +pool.shutdown();</stringProp> | ||
277 | + <stringProp name="scriptLanguage">groovy</stringProp> | ||
278 | + </JSR223Sampler> | ||
279 | + <hashTree/> </hashTree> | ||
347 | <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="固定TPM" enabled="true"> | 280 | <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="固定TPM" enabled="true"> |
348 | <stringProp name="TestPlan.comments"></stringProp> | 281 | <stringProp name="TestPlan.comments"></stringProp> |
349 | <doubleProp> | 282 | <doubleProp> |
-
Please register or login to post a comment