You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by khaing nyunt <kh...@yahoo.com> on 2002/10/21 21:36:12 UTC

Function in Jmeter

Hello,

 I am using Jmeter 1.8 and I try to use __ThreadNum, _Counter and __regexFunction in app. I choose Option/Function Helper Dlg and add Name( MSISDN) and value (.*) and generate for __threadNum. I got ${__threadNum(.*)}. Then I replace the MSISDN witih ${__threadNum(.*)} whenevern I used in HTTP request. It does not work.

What do I need to do? Please tell me procedure or some sample program or turtorial to get right stuff.

Thanks in advance.

Kai



---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site

Re: Function in Jmeter

Posted by Michal Kostrzewa <M....@pentacomp.com.pl>.
Dnia pon 21. październik 2002 23:31, Mike Stover napisał:
> Updated!  I've actually been doing some JMeter work recently.  I'm
> currently making a save service component, so that more options are
> available (and, like everything else, it'll be plug and play, so you can
> implement it be a Database saving service, if the fancy strikes you).  I'm
> being very slow, though, cause I've gotten lazy since becoming unemployed

Hmmmm, I see you're doing exactly what I'm doing.... I wanted to make 
collectors to collect to csv, db, xml and so one and I multiplied 
ResultCollector class (it means I did AbstractResultCollector and from that 
FileResultCollector and from that XMLResultCollector and CSVResultCollector. 
JDBCResultCollector inherits directly from AbstractResultCollector). 
I think you want to achieve the same aim, but in different way (probably 
better, because you know jMeter very good, better than I do).

If you have some tasks to share with me, I'll appreciate if you tell me. I 
declare I have some free time (at nights :-)), I'm quite comfortable with 
jMeter's code and I very like this project.

best regards
Michal Kostrzewa



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Function in Jmeter

Posted by Mike Stover <ms...@apache.org>.
Updated!  I've actually been doing some JMeter work recently.  I'm currently 
making a save service component, so that more options are available (and, like 
everything else, it'll be plug and play, so you can implement it be a Database 
saving service, if the fancy strikes you).  I'm being very slow, though, cause I've 
gotten lazy since becoming unemployed :-(

-Mike

On 21 Oct 2002 at 23:21, Michal Kostrzewa wrote:

> > Referencing to the result of a function in following requests is a bit
> > tricky, it depends on functions and I personally saw no documentation about
> > this. For example to refer to previous regex result, matching group one,
> 
> Oh, I'm sorry, I've just seen the documentation and everything is explained 
> (_g1 and so..) I was blind or the docs were upgraded recently.... (thank you 
> Mike Stover)
> 
> best regards
> Michal Kostrzewa
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



--
Michael Stover
mstover1@apache.org
Yahoo IM: mstover_ya
ICQ: 152975688

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Function in Jmeter

Posted by Michal Kostrzewa <M....@pentacomp.com.pl>.
> Referencing to the result of a function in following requests is a bit
> tricky, it depends on functions and I personally saw no documentation about
> this. For example to refer to previous regex result, matching group one,

Oh, I'm sorry, I've just seen the documentation and everything is explained 
(_g1 and so..) I was blind or the docs were upgraded recently.... (thank you 
Mike Stover)

best regards
Michal Kostrzewa


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: problem with _regexFunction

Posted by Venkat Dosapati <ve...@translogicsys.com>.
then, who is the person looking after these code changes?
Shall I post these in dev group?

--
Venkat
----- Original Message -----
From: "Michal Kostrzewa" <M....@pentacomp.com.pl>
To: "JMeter Users List" <jm...@jakarta.apache.org>
Sent: Tuesday, November 19, 2002 1:02 AM
Subject: Re: problem with _regexFunction


> Dnia czw 14. listopad 2002 11:05, Venkat Dosapati napisał:
> > Mike,
> >
> > I think I fixed this problem. Can you please look into the attached
file.
> > You can see my
> > code from line number 97 - 100. Can you update RegexFunction.java in
JMeter
> > source files if my fix is correct.
>
> I don't know if you finally got response from Mike Stover, but It's
possible
> he won't respond quickly. I talked to him recently and he said he has some
> important, personal matters which don't allow him to work on jMeter.
>
> best regards
> Michal Kostrzewa
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: problem with _regexFunction

Posted by Michal Kostrzewa <M....@pentacomp.com.pl>.
Dnia czw 14. listopad 2002 11:05, Venkat Dosapati napisał:
> Mike,
>
> I think I fixed this problem. Can you please look into the attached file.
> You can see my
> code from line number 97 - 100. Can you update RegexFunction.java in JMeter
> source files if my fix is correct.

I don't know if you finally got response from Mike Stover, but It's possible 
he won't respond quickly. I talked to him recently and he said he has some 
important, personal matters which don't allow him to work on jMeter.

best regards
Michal Kostrzewa


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: problem with _regexFunction

Posted by Venkat Dosapati <ve...@translogicsys.com>.
sorry, I forgot attach the file in my previous mail.

----- Original Message -----
From: "Venkat Dosapati" <ve...@translogicsys.com>
To: "JMeter Users List" <jm...@jakarta.apache.org>
Sent: Thursday, November 14, 2002 3:35 PM
Subject: Re: problem with _regexFunction


> Mike,
>
> I think I fixed this problem. Can you please look into the attached file.
> You can see my
> code from line number 97 - 100. Can you update RegexFunction.java in
JMeter
> source files if my fix is correct.
>
> The problem was function value is not getting updated with default value
in
> JMeterVariables when no match is found in the previous response.
>
> --tnx
> Venkat
>
>
> ----- Original Message -----
> From: "Venkat Dosapati" <ve...@translogicsys.com>
> To: "JMeter Users List" <jm...@jakarta.apache.org>
> Sent: Wednesday, October 23, 2002 8:42 PM
> Subject: problem with _regexFunction
>
>
> > Hello Mike,
> >
> > [I am using nightly build on October 7th 2002.]
> >
> > I am using regexFunction in my TestPlan. My testplan has the following
> > requests in a
> > LoopController.
> >
> > 1. HTTP request:
> >     which gives the data on which my function is executed.
> > 2.HTTP request:
> >     Where regexFunction is executed on previous request's response data.
> > 3.HTTP request:
> >    Where the functionName is used to use the above value.
> >
> > Situation 1:
> > LoopController has 1 iteration.
> > In the iteration, first request's response doesnt have the required data
> for
> > which
> > the function is looking for and the function name is replaced with
default
> > value. Here it
> > is working correct.
> >
> >
> > Situation 2:
> > LoopController has 2 iterations.
> > In first iteration, first request's response has the required data for
> which
> > the function is
> > looking.
> > In the second iteration, first request's response doesnt have the
required
> > data for which
> > function is looking. "But the function value is not replaced with
default
> > value", it is taking
> > previous value which was found in the first iteration.
> >
> >
> > Why function's value in the "situation 2" is not updated with default
> value
> > when no-match
> > is found in the second iteration. Is it a bug. Or I'm missing anything.
> >
> > Please help me out.
> >
> > --tnx
> > Venkat
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>

Re: problem with _regexFunction

Posted by Venkat Dosapati <ve...@translogicsys.com>.
Mike,

I think I fixed this problem. Can you please look into the attached file.
You can see my
code from line number 97 - 100. Can you update RegexFunction.java in JMeter
source files if my fix is correct.

The problem was function value is not getting updated with default value in
JMeterVariables when no match is found in the previous response.

--tnx
Venkat


----- Original Message -----
From: "Venkat Dosapati" <ve...@translogicsys.com>
To: "JMeter Users List" <jm...@jakarta.apache.org>
Sent: Wednesday, October 23, 2002 8:42 PM
Subject: problem with _regexFunction


> Hello Mike,
>
> [I am using nightly build on October 7th 2002.]
>
> I am using regexFunction in my TestPlan. My testplan has the following
> requests in a
> LoopController.
>
> 1. HTTP request:
>     which gives the data on which my function is executed.
> 2.HTTP request:
>     Where regexFunction is executed on previous request's response data.
> 3.HTTP request:
>    Where the functionName is used to use the above value.
>
> Situation 1:
> LoopController has 1 iteration.
> In the iteration, first request's response doesnt have the required data
for
> which
> the function is looking for and the function name is replaced with default
> value. Here it
> is working correct.
>
>
> Situation 2:
> LoopController has 2 iterations.
> In first iteration, first request's response has the required data for
which
> the function is
> looking.
> In the second iteration, first request's response doesnt have the required
> data for which
> function is looking. "But the function value is not replaced with default
> value", it is taking
> previous value which was found in the first iteration.
>
>
> Why function's value in the "situation 2" is not updated with default
value
> when no-match
> is found in the second iteration. Is it a bug. Or I'm missing anything.
>
> Please help me out.
>
> --tnx
> Venkat
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


problem with _regexFunction

Posted by Venkat Dosapati <ve...@translogicsys.com>.
Hello Mike,

[I am using nightly build on October 7th 2002.]

I am using regexFunction in my TestPlan. My testplan has the following
requests in a
LoopController.

1. HTTP request:
    which gives the data on which my function is executed.
2.HTTP request:
    Where regexFunction is executed on previous request's response data.
3.HTTP request:
   Where the functionName is used to use the above value.

Situation 1:
LoopController has 1 iteration.
In the iteration, first request's response doesnt have the required data for
which
the function is looking for and the function name is replaced with default
value. Here it
is working correct.


Situation 2:
LoopController has 2 iterations.
In first iteration, first request's response has the required data for which
the function is
looking.
In the second iteration, first request's response doesnt have the required
data for which
function is looking. "But the function value is not replaced with default
value", it is taking
previous value which was found in the first iteration.


Why function's value in the "situation 2" is not updated with default value
when no-match
is found in the second iteration. Is it a bug. Or I'm missing anything.

Please help me out.

--tnx
Venkat



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Function in Jmeter

Posted by khaing nyunt <kh...@yahoo.com>.
Hello Mike,
 It works. Thank you very much for your help. I really appriciate your help. It is very difficult to find example or docs. and Jmeter docs is not enough for newcomer like me.
Thank you so very much.
Kai



---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site

Re: Function in Jmeter

Posted by Michal Kostrzewa <M....@pentacomp.com.pl>.
Hi Kai,

Functions are generally described in
http://jakarta.apache.org/jmeter/usermanual/functions.html
and
http://jakarta.apache.org/jmeter/usermanual/component_reference.html#functions

To use __threadnum do the following
1) create the request object
2) create a param
3) Open function helper dlg
4) Choose __threadNum. This function needs no additional parameters.
5) click generate
6) copy what it generates and paste it as a value to sampler param. It should 
look like ${__threadNum}, nothing more nothing less...

Another functions are used in similar way, you need to fill only requested 
fields in helper dialog. 
Referencing to the result of a function in following requests is a bit tricky, 
it depends on functions and I personally saw no documentation about this. For 
example to refer to previous regex result, matching group one, named for 
example id, you should write ${id_g1} (for further reference check in this 
mailng list archive and if that fails, ask on this list)

best regards
Michal Kostrzewa


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>