jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Speteanu <asp.ad...@gmail.com>
Subject Re: Sharing logic between thread groups
Date Thu, 13 Jun 2013 15:19:58 GMT
You can add a header manager to use the same header for all your requests.
Use the header manager in a parent of all the samples that need to be in
its scope. For those requests that need to over-write it, use the HM as
child to those samplers.

For the general question: can logic be shared between threads? It has been
discussed recently, check those discussions first, maybe you find some
useful tips there, or share with us what those threads don't cover.

Cheers,
Adrian

On Thu, Jun 13, 2013 at 3:54 PM, Drach, Noa <Noa.Drach@ca.com> wrote:

> Hello all,
>
> In my test I have 5 thread groups - I was wondering if it is possible to
> share common logic between the thread groups.
>
> Basically all of my tests have user id and organization id in the headers.
> For each thread that is running I am randomly selecting a user id in the
> range of 1-50 and organization id in the range of 1-100.
>
> All this is achieved by using a Bean Shell Preprocessor that is attached
> to each of the samplers.
>
> For each of the samplers this random editing of the header might also be
> accompanied by some editing of the url as a result of the random user ID.
>
> By attaching a preprocessor to each sample I manage to do all this - but I
> was wondering if there is some way to define some utility methods that I
> can call from each Bean Shell processor and avoid repeating the logic.
>
> For example:
> ...
> HeaderManager hm = sampler.getHeaderManager();
> callMySetHeaders(hm);
> // Do some specific code
>
> I know that it is possible to have custom functions - but my understanding
> is that they only return a string - I am asking if there is a way to write
> more complex code.
>
> Thanks,
> Noa Drach
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message