动态Paralell HTTP请求 [英] Paralell HTTP Request dynamically

查看:66
本文介绍了动态Paralell HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在paralell中执行一些请求,我看到了jp @ gc-并行HTTP请求,但是我找不到一种将URL动态加载到控制器中的方法.我的问题是要命中的URL来自JSON响应;在变量中指示URL的方式是什么?是否存在使用JSR232或beanshell包括URL来操纵采样器的任何方法?或者,也许我该如何在执行时做一个线程组和一个HTTP采样器?

I need perform some requests in paralell, I saw jp@gc - Parallel HTTP Requests, but I can´t found a way to load dynamically the URL´s in to the controller; my problem is the URLs to hit come from a JSON response; What is the way to indicate the URLs in a variable? Exist any way to manipulate the sampler using a JSR232 or beanshell to include the URLs? Or maybe how can I do a Thread Group and a HTTP sampler in execution time?

亲切的问候,

Alejandro Longas H.

Alejandro Longas H.

推荐答案

如果您正在寻找将URL添加到

If you're looking for a code to add URLs to the Parallel HTTP Requests sampler in the JMeter runtime:

  1. 添加 setUp线程组到您的测试计划
  2. JSR223采样器添加到setUp线程组
  3. 将以下代码放入脚本"区域:

  1. Add setUp Thread Group to your Test Plan
  2. Add JSR223 Sampler to the setUp Thread Group
  3. Put the following code into "Script" area:

SampleResult.setIgnore()
def testTree = ctx.getEngine().test
def parallelSamplerSearch = new org.apache.jorphan.collections.SearchByClass<>(com.blazemeter.jmeter.http.ParallelHTTPSampler.class)
testTree.traverse(parallelSamplerSearch)
def parallelSampler = parallelSamplerSearch.getSearchResults().first()
parallelSampler.addURL('http://example.com')
parallelSampler.addURL('http://jmeter.apache.org')

  • 就是这样,现在并行HTTP请求采样器应该同时向上述URL发出2个请求.

  • That's it, now Parallel HTTP Request sampler should fire 2 requests to the above URLs simultaneously.

    这篇关于动态Paralell HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆