waseemfa | 9 Jan 14:36 2012
Picon

Re: How to capture a value in one of the thread and passing it to the other thread in the same test plan

HI,

Basically there is no way of doing this in JMeter.  the one thing i can
think of is use the appropriate method to get the data and store it in a
user defined property like

${__setProperty(input, ${input})};

and in the next thread group access the input variable just like any other
property variable

${__property(input)}

Hope this works.

-Waseem

--
View this message in context: http://jmeter.512774.n5.nabble.com/How-to-capture-a-value-in-one-of-the-thread-and-passing-it-to-the-other-thread-in-the-same-test-plan-tp5124673p5131347.html
Sent from the JMeter - User mailing list archive at Nabble.com.
Bruce Ide | 9 Jan 15:58 2012
Picon

Re: How to capture a value in one of the thread and passing it to the other thread in the same test plan

Usually you don't want to do that. Threads make your test much more
complicated, and you must take into account timing, locking and
synchronization issues that can make things very unpredictable. In the vast
majority of cases where someone is attempting to use threads, there is no
reason to. If your test has the same user doing things one after another
and you're trying to use threads to do this, rewrite your test to be linear.

If you really must use threads after all that discouraging, I wrote a small
plugin that enables passing data between threads. There are probably more
intuitive ways it could work, but it worked for what I needed it to. You
can find it at https://github.com/FlyingRhenquest/JmeterThreadGlobal. You
might also want to look at my thread synchronization plugin, which I like
slightly more than the stock jmeter thread synchronization time.
https://github.com/FlyingRhenquest/JmeterThreadSync.

--

-- 
Bruce Ide
FlyingRhenquest <at> gmail.com
Philippe Mouawad | 9 Jan 16:11 2012
Picon

Re: How to capture a value in one of the thread and passing it to the other thread in the same test plan

Hello Bruce,

A little note about
FlyingRhenques<https://github.com/FlyingRhenquest/JmeterThreadGlobal>t,
looking at code it seems to me synchronization can only work if one JVM is
used right ?
Note that if you're willing to, your feature could be useful in JMeter and
answser user enhancement request:

   - https://issues.apache.org/bugzilla/show_bug.cgi?id=43384

And I agree with you sharing WRITE ALSO data between threads is a bad idea
and maybe reveals a Test Plan misconception.

Regards
Philippe
http://www.ubik-ingenierie.com

On Mon, Jan 9, 2012 at 3:58 PM, Bruce Ide <flyingrhenquest <at> gmail.com> wrote:

> Usually you don't want to do that. Threads make your test much more
> complicated, and you must take into account timing, locking and
> synchronization issues that can make things very unpredictable. In the vast
> majority of cases where someone is attempting to use threads, there is no
> reason to. If your test has the same user doing things one after another
> and you're trying to use threads to do this, rewrite your test to be
> linear.
>
> If you really must use threads after all that discouraging, I wrote a small
> plugin that enables passing data between threads. There are probably more
(Continue reading)

Bruce Ide | 9 Jan 17:06 2012
Picon

Re: How to capture a value in one of the thread and passing it to the other thread in the same test plan

Hmm. I'm not using semaphores in JmeterThreadSync, but you could easily
modify just the CheckPointObject to acquire them. Though it might be easier
to check for unreleased semaphores in the Config element at test start or
test end time.

The couple of tests I wrote with this code were very complex due to the
threading and the stuff that was being tested should have been modified to
allow for linear testing with a usability defect. I'm not entirely sure
that level of IPC should be commonly available in the tool; if you really
need it, you should probably have the technical skills to set it up. I
think that gives you a better chance to understand and accept the risks
involved.

That being said, this is probably going to gnaw on me now, so I might end
up taking a look at it over some weekend anyway. You know the next guy is
going to want it to run across multiple machines, though...

--

-- 
Bruce Ide
FlyingRhenquest <at> gmail.com
Robin D. Wilson | 9 Jan 17:48 2012
Picon

RE: How to capture a value in one of the thread and passing it to the other thread in the same test plan

I've used "Properties" before...

I have this in one of my test plans (in a "User Parameters" pre-processor) :

	threadStartTime = ${__javaScript(var ms = new Date; ms.getTime();)}

	theTime = ${__setProperty(ThreadStartTime, ${threadStartTime})}

(theTime variable isn't used anywhere).
Then I use (in the next thread group - in a "User Parameter" pre-processor):

	lastThreadStartTime = ${__P(ThreadStartTime,0)}

This method only works when the thread groups run sequentially though...

--
Robin D. Wilson
Sr. Director of Web Development
KingsIsle Entertainment, Inc.
VOICE: 512-777-1861
www.KingsIsle.com

-----Original Message-----
From: Bruce Ide [mailto:flyingrhenquest <at> gmail.com] 
Sent: Monday, January 09, 2012 10:07 AM
To: JMeter Users List
Subject: Re: How to capture a value in one of the thread and passing it to
the other thread in the same test plan

Hmm. I'm not using semaphores in JmeterThreadSync, but you could easily
(Continue reading)

Adrian Speteanu | 19 Jan 12:05 2012
Picon

Re: How to capture a value in one of the thread and passing it to the other thread in the same test plan

Hi,

You can also consider this:
http://jmeter.apache.org/usermanual/best-practices.html#beanshell_server

if you use the method described in previous mail by Robin.

Regards,
Adrian

On Mon, Jan 9, 2012 at 6:48 PM, Robin D. Wilson <rwilson2 <at> gmail.com> wrote:

> I've used "Properties" before...
>
> I have this in one of my test plans (in a "User Parameters" pre-processor)
> :
>
>        threadStartTime = ${__javaScript(var ms = new Date; ms.getTime();)}
>
>        theTime = ${__setProperty(ThreadStartTime, ${threadStartTime})}
>
> (theTime variable isn't used anywhere).
> Then I use (in the next thread group - in a "User Parameter"
> pre-processor):
>
>        lastThreadStartTime = ${__P(ThreadStartTime,0)}
>
> This method only works when the thread groups run sequentially though...
>
> --
(Continue reading)

Picon

RE: How to capture a value using regular expression extrators

Thnxs sebb, I try a lot of forms, but at least i found one that work fine

it is in the value of the regular expression

id= "([^"]*)"

So that expression catch the number of the idea and, through out the rest of the html code
That kind of regular expression would be great to be put on a page in the site of jmeter as tricks or something
like that, I think, or in other file as example of how to use regular expressions

And also all the users of the community would add their own tricks

-----Original Message-----
From: sebb [mailto:sebbaz <at> gmail.com]
Sent: Martes, 01 de Noviembre de 2005 02:35 p.m.
To: JMeter Users List
Subject: Re: How to capture a value using regular expression extrators

On 01/11/05, Rolando Sanchez Villalobos <rsanchez <at> avanticatec.net> wrote:
>
> Hi All,
>
> Is there a way to get in JMeter the value of a variable, I stay using
> Regular Expresion Extractor, but the value is an ID autogenerate and
> autoincremental, so how I can construct my regular expression to extract
> the value of the ID, also the system uses struts

Yes, the Regular Expression Extractor can be used to extract anything
from a sampler response.

(Continue reading)

sebb | 2 Nov 13:50 2005
Picon

Re: How to capture a value using regular expression extrators

id="(.+?)"

might be better - it will not match an empty id, i.e. id=""

The ? makes the RE non-greeedy, so no need to exclude ".

S.
On 01/11/05, Rolando Sánchez Villalobos <rsanchez <at> avanticatec.net> wrote:
> Thnxs sebb, I try a lot of forms, but at least i found one that work fine
>
> it is in the value of the regular expression
>
> id= "([^"]*)"
>
> So that expression catch the number of the idea and, through out the rest of the html code
> That kind of regular expression would be great to be put on a page in the site of jmeter as tricks or something
like that, I think, or in other file as example of how to use regular expressions
>
> And also all the users of the community would add their own tricks
>
> -----Original Message-----
> From: sebb [mailto:sebbaz <at> gmail.com]
> Sent: Martes, 01 de Noviembre de 2005 02:35 p.m.
> To: JMeter Users List
> Subject: Re: How to capture a value using regular expression extrators
>
>
> On 01/11/05, Rolando Sanchez Villalobos <rsanchez <at> avanticatec.net> wrote:
> >
> > Hi All,
(Continue reading)


Gmane