You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by "BAZLEY, Sebastian" <Se...@london.sema.slb.com> on 2004/01/13 12:01:03 UTC

RE: Experience using __counter

Try unchecking the "Once per iteration" box.

S.
-----Original Message-----
From: Sonam Chauhan [mailto:sonam.chauhan@ce.com.au]
Sent: 13 January 2004 03:00
To: 'JMeter Users List'
Subject: RE: Experience using __counter


> Try the Pre-Processor User Parameters instead - there is no need to
use
> more than 1 User column.

Thanks Seb. 

I used the User Parameters pre-processor and the counter does increment
- but between threads and iterations only. Is this expected? 

I used a single user column, and set the only row to:
	Name: 	junk
	User_1:	${__counter(FALSE,ctr)}
Next, I put in two HTTP samplers, with their HTTP request path set to:
	 /${ctr}/${junk}

When I run the test with one thread, both the first and second HTTP
request are:
	http://.../1/1
However, with two threads, the increment occurs. The first thread still
is:
	http://.../1/1
But the second thread has both HTTP requests:
	http://.../2/2

Adding iterations has the same effect as adding threads - the counter is
incremented for that iteration. 

Notes:
 (1) 	The counter increments *between* threads and iterations only. 
     	It does not increment between two subsequent requests made 
	in the same thread.
 (2) 	After the 'User Parameters' initialization, both the official 
	counter variable: ${ctr} ;  and the junk placeholder: ${junk}
	incremented. 

How could I increment ${ctr} within a single thread - do I have to use
Javascript? 

With regards,
Sonam Chauhan
-- 
Corporate Express Australia Ltd.
Phone: +61-2-9335-0725, Fax: 9335-0753, Email: sonamc@ce.com.au
 

> -----Original Message-----
> From: Sebastian Bazley [mailto:Sebastian.Bazley@london.sema.slb.com]
> Sent: Tuesday, 13 January 2004 11:57 AM
> To: JMeter Users List
> Subject: Re: Experience using __counter
> 
> 1) I think there might be a problem with that particular config
element -
> it does not seem to handle any functions, not even
> __machineName() (which is about the simplest there is!). And I could
not
> find the element in the menus for JMeter 1.9.1, yet it does
> not appear to be new.
> 
> Looks as though Java config defaults works with functions; I've not
tried
> the rest of the config elements.
> 
> Try the Pre-Processor User Parameters instead - there is no need to
use
> more than 1 User column.
> 
> 2) Don't know.
> 
> S.
> ----- Original Message -----
> From: "Sonam Chauhan" <so...@ce.com.au>
> To: "'JMeter Users List'" <jm...@jakarta.apache.org>
> Sent: Monday, January 12, 2004 4:28 AM
> Subject: Experience using __counter
> 
> 
> I am using the 'SOAP/XML-RPC Request' sampler to test a B2B server
that
> must
> see a unique XML purchase order number each time. A snippet of the XML
> looks
> like this:
> -------------------------------------------
> <Order>
>   <OrderHeader>
>     <OrderNumber>
>       <BuyerOrderNumber>UNIQUE_PO_NUMBER...
> -------------------------------------------
> 
> I tried to use the __counter function to generate a unique PO number.
The
> user manual says a Config element field can be used for this:
> -------------------------------------------
> "Built-in functions can be written into any field of non-controller
test
> components. This includes Samplers, Timers, Listeners, Modifiers,
> Assertions, and Config Elements."
> http://jakarta.apache.org/jmeter/usermanual/functions.html
> -------------------------------------------
> 
> My first attempts were to use Config elements (e.g.: 'User Defined
> Variables') to initialize a counter.
> 
> Creating entries with name and/or values set to:
> ${__counter(FALSE,ctr)}
> did not work - ${ctr} stayed unsubstituted.
> 
> It finally worked when I used the __counter function directly in the
XML-
> RPC
> sampler's data section like below:
> -------------------------------------------
> <Order>
>   <OrderHeader>
>     <OrderNumber>
>       <BuyerOrderNumber>${__counter(FALSE,ctr)}...
> -------------------------------------------
> Once the XML-RPC sampler got executed, I could then refer to ${ctr}
> elsewhere in the testplan.
> 
> I had a couple of questions and would love some feedback:
> 
> 1. Can __counter be initialized in a config element?
> 2. Can the XML I submitted in the 'SOAP/XML-RPC Request' sampler be
loaded
> up from a file? (ReadStringFromFile would
> 
> 
> With regards,
> Sonam Chauhan
> --
> Corporate Express Australia Ltd.
> Phone: +61-2-9335-0725, Fax: 9335-0753, Email: sonamc@ce.com.au
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org