Paralell HTTP Request dynamically

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?

Kind Regards,

Alejandro Longas H.

Upvotes: 1

Views: 832

Answers (1)

Dmitri T
Dmitri T

Reputation: 168002

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

  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')
    
  4. That's it, now Parallel HTTP Request sampler should fire 2 requests to the above URLs simultaneously.

Upvotes: 1

Related Questions