You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by John Kavadias <jo...@nstc.nec.com.au> on 2002/08/21 12:51:17 UTC

How to use ${mycount} in test plan, given ${__counter(?,mycounter)} elsewhere

Hello.

I have been experimenting with some of the JMeter 1.7.3 improvements over JMeter 1.7. Nice!

I am having trouble properly using the __counter function. My understanding from the manual is not improving with re-reading.

I am not using the 'Name of function', the second argument to __counter, properly.

What exactly is the second argument to __counter?

Say I have ${__counter(FALSE,mycount)} used somewhere in the object tree beneath a Thread Group.

My understanding of the second argument is this:

Use it to to expand the counter value 'again', without incrementing the counter value, by putting ${mycount} elsewhere in the Test Plan, under the same Thread Group.

Bearing in mind this test plan is tinkering, not a serious test:

Test Plan (variable: testhost, value: my hostname)
  Thread Group (threads: 3, ramp up: 0, count: 1)
    User Parameters (username, password [defined for 3 users])
    HTTP Request Defaults (server name: ${testhost})
    Simple Controller
      HTTP Request (path: /my/login/url,
                    param: username, value: ${username}
                    param: password, value: ${password}
                    param: counterTest, value: ${__counter(FALSE,mycount)} )
      HTTP Request (path: /some/other/url,
                    param: testTheCounter, value: ${mycount} )

counterTest in the first HTTP request has the expected values (1, 2, 3) for the requests generated by the 3 threads in the group. The global counter for the Thread Group is incremented on each reference to ${__counter(args)}.

testTheCounter in the second HTTP request is just ${mycount}.

Thanks for any pointers,
John Kavadias    johnk@nstc.nec.com.au


Re: How to use ${myREF} in test plan, given ${__regexFunction(...args,myREF)} is used first

Posted by Mike Stover <ms...@apache.org>.
Ok, there's a lot going on here. 

First, a default config object always adds to the requests it configures.  It never replaces.  For 
a config to add, the corresponding slot in the request must be empty.  Now, because of the 
nature the arguments list, a list always has empty "slots".  Thus, any arguments you put into a 
HTTP Defaults object will be added to the arguments of any HTTP Requests it configures.

Second, Just like the counter function, the regex function is actually storing a number of 
values.  It stores every group that the regular expression captured.  These groups are 
referenced by:

yourname_g#

Where # represents the group number.  1 for your first parenthetical grouping and up.  0 
represents the entire match.

And three,  the fact that the function from the config object came through as 
org.apache.jmeter_blahblahblah looks like a bug.  I'll check that part out.

I'd recommend that you get rid of the defaults in this case.  Put the real function call in the first 
request, and use the stored values in the second.

-Mike


On 22 Aug 2002 at 19:32, John Kavadias wrote:

> Hello.
> 
> Thanks (Mike) for the pointer on how to 're'reference the values of named counters in a test plan. Works!
> 
> I am having trouble similar trouble properly using the last (ie name) argument of the __regexFunction.
> 
> Looking at a substructure I have in my Test Plan:
> 
> Assume preceding structure produces a preceding HTTP response
> Simple Controller
>   HTTP Request Defaults (uses two __regexFunction(...,name)s
>                          param: oneName,
>                          value: ${__regexFunction(...,oneREF)}
>                          param: twoName,
>                          value: ${__regexFunction(...,twoREF)} )
>   HTTP Request ONE      (param: oneName, value: ${oneREF}
>                          param: twoName, value: ${twoREF} )
>   HTTP Request TWO      (param: oneName, value: ${oneREF}
>                          param: twoName, value: ${twoREF} )
> 
> So, I was hoping to get the HTTP Requests, ONE and TWO, to visit their Paths with the same parameter name,value pairs.
> 
> The ${oneREF} and ${twoREF} do not expand. They are literaly repeated in the generated request URLs (yep, I am using GET).
> 
> Also, though the parameter names used in the HTTP Request Defaults is the same as those in the individual requests, the parameters oneName and twoName appear twice in the generated URLs of both HTTP Requests ONE and TWO. The default values and the request specified values are both used to 
generate the URLs.
> 
> Separated by '&' I get this parameter list on each HTTP Request:
> 
> oneName=${oneREF}
> twoName=${twoREF}
> oneName=org.apache.jmeter.functions.CompoundFunction@86793e
> twoName=org.apache.jmeter.functions.CompoundFunction@81f91a
> 
> As you can see the ${__regexFunction(...,name)} invocations are expanded (in the HTTP Request Defaults) to the default Object.toString() values of an underlying Java object in the test plan execution.
> 
> Thanks for any pointers. I hope this is simple misuse on my part.
> John Kavadias    johnk@nstc.nec.com.au



--
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: How to use ${mycount} in test plan, given ${__counter(?,mycounter)} elsewhere

Posted by Mike Stover <ms...@apache.org>.
Well, I haven't had a chance to document this yet, so forgive me.  The counter function 
creates two stored values:

yourname_true
yourname_false

These versions represent the TRUE and FALSE versions of the first argument.

-Mike

On 21 Aug 2002 at 20:51, John Kavadias wrote:

> Hello.
> 
> I have been experimenting with some of the JMeter 1.7.3 improvements over JMeter 1.7. Nice!
> 
> I am having trouble properly using the __counter function. My understanding from the manual is not improving with re-reading.
> 
> I am not using the 'Name of function', the second argument to __counter, properly.
> 
> What exactly is the second argument to __counter?
> 
> Say I have ${__counter(FALSE,mycount)} used somewhere in the object tree beneath a Thread Group.
> 
> My understanding of the second argument is this:
> 
> Use it to to expand the counter value 'again', without incrementing the counter value, by putting ${mycount} elsewhere in the Test Plan, under the same Thread Group.
> 
> Bearing in mind this test plan is tinkering, not a serious test:
> 
> Test Plan (variable: testhost, value: my hostname)
>   Thread Group (threads: 3, ramp up: 0, count: 1)
>     User Parameters (username, password [defined for 3 users])
>     HTTP Request Defaults (server name: ${testhost})
>     Simple Controller
>       HTTP Request (path: /my/login/url,
>                     param: username, value: ${username}
>                     param: password, value: ${password}
>                     param: counterTest, value: ${__counter(FALSE,mycount)} )
>       HTTP Request (path: /some/other/url,
>                     param: testTheCounter, value: ${mycount} )
> 
> counterTest in the first HTTP request has the expected values (1, 2, 3) for the requests generated by the 3 threads in the group. The global counter for the Thread Group is incremented on each reference to ${__counter(args)}.
> 
> testTheCounter in the second HTTP request is just ${mycount}.
> 
> Thanks for any pointers,
> John Kavadias    johnk@nstc.nec.com.au
> 



--
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>


How to use ${myREF} in test plan, given ${__regexFunction(...args,myREF)} is used first

Posted by John Kavadias <jo...@nstc.nec.com.au>.
Hello.

Thanks (Mike) for the pointer on how to 're'reference the values of named counters in a test plan. Works!

I am having trouble similar trouble properly using the last (ie name) argument of the __regexFunction.

Looking at a substructure I have in my Test Plan:

Assume preceding structure produces a preceding HTTP response
Simple Controller
  HTTP Request Defaults (uses two __regexFunction(...,name)s
                         param: oneName,
                         value: ${__regexFunction(...,oneREF)}
                         param: twoName,
                         value: ${__regexFunction(...,twoREF)} )
  HTTP Request ONE      (param: oneName, value: ${oneREF}
                         param: twoName, value: ${twoREF} )
  HTTP Request TWO      (param: oneName, value: ${oneREF}
                         param: twoName, value: ${twoREF} )

So, I was hoping to get the HTTP Requests, ONE and TWO, to visit their Paths with the same parameter name,value pairs.

The ${oneREF} and ${twoREF} do not expand. They are literaly repeated in the generated request URLs (yep, I am using GET).

Also, though the parameter names used in the HTTP Request Defaults is the same as those in the individual requests, the parameters oneName and twoName appear twice in the generated URLs of both HTTP Requests ONE and TWO. The default values and the request specified values are both used to generate the URLs.

Separated by '&' I get this parameter list on each HTTP Request:

oneName=${oneREF}
twoName=${twoREF}
oneName=org.apache.jmeter.functions.CompoundFunction@86793e
twoName=org.apache.jmeter.functions.CompoundFunction@81f91a

As you can see the ${__regexFunction(...,name)} invocations are expanded (in the HTTP Request Defaults) to the default Object.toString() values of an underlying Java object in the test plan execution.

Thanks for any pointers. I hope this is simple misuse on my part.
John Kavadias    johnk@nstc.nec.com.au