You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by virkenator <vi...@gmail.com> on 2010/06/02 01:42:53 UTC

how to generate unique ids in jmeter

I am a newbie. I am using JMeter to test registration form based software.
Here's my scenario:

A user logs in and adds a patient in database. I am able to automate this
process by recording it, however I want to automate the add patient
scenario, since a unique patient id is required to add a patient and save it
on the database. The procedure I am following right now is manually entering
ids and then running the automated script, which is not putting any load or
stress on the site.
If somebody could please tell me how to generate unique ids and how to fit
this procedure in already working script or how to increment previous id
whenever the script is run.




-- 
View this message in context: http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28748660.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: how to generate unique ids in jmeter

Posted by Rodolfo Landa <ro...@gmail.com>.
I had a similar requirement:

In my test plan an http request was being called like this:

     /myurl/a/b/c/trackid=abcd-efgh

Where abcd and efgh are unique numbers for each User (Thread) / Loop.

I added a User Parameters control before calling this http request like
this:

Name 1: id_first
User_1: ${__Random(1,1000,ID_FIRST)}

Name 2: id_second
User_2: ${__Random(2001,3000,ID_SECOND)}

Then I replace these variables in the original http request like this:

     /myurl/a/b/c/trackid=${ID_FIRST}-${ID_SECOND}

Notes:

a) I checked the option Update Once Per Iteration in the User Parameters
control
b) My test plan has other http request that need the same calculated track
id for that User / Loop.
b) I first used id_first and id_second but every time I call them in other
http request the random numbers are re-calculated. Using ID_FIRST and
ID_SECOND solved that problem for me.

I hope this is similar to your problem and can help you.

Regards,

Rodolfo



On Wed, Jun 2, 2010 at 12:12 PM, virkenator <vi...@gmail.com> wrote:

>
> Hi Deepak,
>
> Thank you for the help. I tried it, but in vain. May be I need to explain
> you more details. When I create a patient, that data needs to be posted
> through the HTTP request to the server.
> Here is how my script works.
> 1. A user logs in
> 2. Goes to the patient registration form.
> 3. Adds patient id, which has to be unique every time patient needs to be
> added.
> 4. Saves the form and logs out.
> This script has all the HTTP requests. During the step 3, there are two
> fields(patient id and patientkey) which need to be edited (which I am
> presently editing manually) and posted as the HTTP request for step 3.
> I am wondering is there any way, I can increment or create unique values
> for
> these two fields and then POST them as a HTTP request automatically.
>
> Deepak Shetty wrote:
> >
> > This is one way
> > add a User Parameters , just one user will do,  specify the name like
> > currentTime and value like ${__time(YMD)}${__time(HMS) . Also check
> update
> > once per iteration (basically generating a timestamp , you can use other
> > ways to generate a timestamp too , the reason I do it this way is that I
> > need this value for multiple samplers)
> > Then when you need to post a unique data element, you can provide a value
> > like
> > ${userIdPrefix}_${__threadNum()}_${currentTime}
> >
> > where userIdPrefix is a variable normally defined as JMeterCreatedUser or
> > something .
> >
> > Note that because JMeter can call javascript or even Java/BSH any method
> > you
> > want of generating unique ids works (for example you could use UUID's)
> >
> > regards
> > deepak
> >
> > On Tue, Jun 1, 2010 at 4:42 PM, virkenator <vi...@gmail.com> wrote:
> >
> >>
> >> I am a newbie. I am using JMeter to test registration form based
> >> software.
> >> Here's my scenario:
> >>
> >> A user logs in and adds a patient in database. I am able to automate
> this
> >> process by recording it, however I want to automate the add patient
> >> scenario, since a unique patient id is required to add a patient and
> save
> >> it
> >> on the database. The procedure I am following right now is manually
> >> entering
> >> ids and then running the automated script, which is not putting any load
> >> or
> >> stress on the site.
> >> If somebody could please tell me how to generate unique ids and how to
> >> fit
> >> this procedure in already working script or how to increment previous id
> >> whenever the script is run.
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28748660.html
> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28758835.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: how to generate unique ids in jmeter

Posted by Deepak Shetty <sh...@gmail.com>.
It was posted in detail previously.

On Wed, Jun 2, 2010 at 4:24 PM, virkenator <vi...@gmail.com> wrote:

>
> Hi,
>
> I totally agree with you that, to generate a random value is more
> beneficial
> than incrementing the previous one.
> My application can handle any type of string. If you could please help me
> figure out, how to create/generate random values and how to append them in
> the script, I would highly appreciate.
>
> Deepak Shetty wrote:
> >
> > Hi
> > Either you use an incremented variable in which case you will have to
> > maintain what was the last used value (or atleast retrieve it) or you can
> > use any random value (So long as it is unique), the latter is easier
> > because
> > you dont need to care about the previously used values (or even running
> it
> > across multiple machines), any new value is always  unique (however by
> > nature these are strings and your application may not be able to handle
> > strings). So the question is can your application handle any unique
> string
> > or not?
> >
> > If you need to use a numeric value then use a counter as mentioned
> > previously. How you get the value to add the counter to depends on your
> > app.
> > You can do this outside of JMeter and pass it to Jmeter as a property ,
> > you
> > can have a setup thread group in Jmeter which for e.g. reads from a
> > database
> > the max value and sets that into a property or you can read the value
> from
> > a
> > file and at the end of the test update that file
> >
> > If you have to distribute the test across machines then auto increment
> > will
> > be tougher to manage.
> >
> > regards
> > deepak
> >
> >
> >
> > On Wed, Jun 2, 2010 at 3:17 PM, virkenator <vi...@gmail.com> wrote:
> >
> >>
> >> No, not a token but an incremented value for the field, so that i dont
> >> have
> >> to increment it manually. Because once the script is run, it can not be
> >> re-run with same value for the field.
> >> That ways, the script will add patients automatically depending on the
> >> number of loops specified.
> >> I hope, I am understandable.
> >>
> >> Deepak Shetty wrote:
> >> >
> >> > so you actually want an incremented numeric field only? Not a unique
> >> token
> >> > ?
> >> >
> >> > regards
> >> > deepak
> >> >
> >> > On Wed, Jun 2, 2010 at 2:33 PM, virkenator <vi...@gmail.com>
> >> wrote:
> >> >
> >> >>
> >> >> Hello Deepak,
> >> >>
> >> >> Thank you replying.
> >> >> Patient t ID is a mandatory field in the form, and it has to be
> >> >> unique/different from IDs already entered/existing in the form
> >> database,
> >> >> that is why user has to specify id every time he/she wants to save
> the
> >> >> form
> >> >> and if it is not different/unique from already existing one, the form
> >> >> will
> >> >> not get saved.
> >> >> However, the script will run just fine.
> >> >>
> >> >> Deepak Shetty wrote:
> >> >> >
> >> >> > First i dont quite think your description is accurate since Id find
> >> it
> >> >> > hard
> >> >> > to believe that your application asks the user who's entering
> >> >> information
> >> >> > into the form to generate the unique Id.  So if I access your
> >> >> application
> >> >> > in
> >> >> > a browser do i have to enter a unique patient id?
> >> >> >
> >> >> > For the moment Assuming  that your problem is what you state it is
> >> >> >
> >> >> >
> >> >> > Thread Group
> >> >> > +Req1
> >> >> > +Req2
> >> >> > +Req3 (specify the below as name/value)
> >> >> > ++patientId   Patient_${__threadNum()}_${currentTime}
> >> >> > ++ other parameters
> >> >> > +Req4
> >> >> > +User Parameters ( update once per iteration checked with the
> >> following
> >> >> > variable)
> >> >> > ++currentTime ${__time(YMD)}${__time(HMS)
> >> >> >
> >> >> > Then add a view results tree listener , and in the request tab you
> >> can
> >> >> see
> >> >> > that you are posting unique values for patientId every time
> >> >> > Your test may still not work , but the problem wont be the
> >> generation
> >> >> of
> >> >> > unique value.
> >> >> >
> >> >> >
> >> >> > If you want an autoincrementing scheme then you need to use
> >> >> >
> >> >>
> >>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Counterplus
> >> >> > beanshell to track the last used counter number from a previous
> test
> >> >> > run or you can code it in beanshell/java
> >> >> >
> >> >> > regards
> >> >> > deepak
> >> >> >
> >> >> > On Wed, Jun 2, 2010 at 12:12 PM, virkenator <vi...@gmail.com>
> >> >> wrote:
> >> >> >
> >> >> >>
> >> >> >> Hi Deepak,
> >> >> >>
> >> >> >> Thank you for the help. I tried it, but in vain. May be I need to
> >> >> explain
> >> >> >> you more details. When I create a patient, that data needs to be
> >> >> posted
> >> >> >> through the HTTP request to the server.
> >> >> >> Here is how my script works.
> >> >> >> 1. A user logs in
> >> >> >> 2. Goes to the patient registration form.
> >> >> >> 3. Adds patient id, which has to be unique every time patient
> needs
> >> to
> >> >> be
> >> >> >> added.
> >> >> >> 4. Saves the form and logs out.
> >> >> >> This script has all the HTTP requests. During the step 3, there
> are
> >> >> two
> >> >> >> fields(patient id and patientkey) which need to be edited (which I
> >> am
> >> >> >> presently editing manually) and posted as the HTTP request for
> step
> >> 3.
> >> >> >> I am wondering is there any way, I can increment or create unique
> >> >> values
> >> >> >> for
> >> >> >> these two fields and then POST them as a HTTP request
> >> automatically.
> >> >> >>
> >> >> >> Deepak Shetty wrote:
> >> >> >> >
> >> >> >> > This is one way
> >> >> >> > add a User Parameters , just one user will do,  specify the name
> >> >> like
> >> >> >> > currentTime and value like ${__time(YMD)}${__time(HMS) . Also
> >> check
> >> >> >> update
> >> >> >> > once per iteration (basically generating a timestamp , you can
> >> use
> >> >> >> other
> >> >> >> > ways to generate a timestamp too , the reason I do it this way
> is
> >> >> that
> >> >> >> I
> >> >> >> > need this value for multiple samplers)
> >> >> >> > Then when you need to post a unique data element, you can
> provide
> >> a
> >> >> >> value
> >> >> >> > like
> >> >> >> > ${userIdPrefix}_${__threadNum()}_${currentTime}
> >> >> >> >
> >> >> >> > where userIdPrefix is a variable normally defined as
> >> >> JMeterCreatedUser
> >> >> >> or
> >> >> >> > something .
> >> >> >> >
> >> >> >> > Note that because JMeter can call javascript or even Java/BSH
> any
> >> >> >> method
> >> >> >> > you
> >> >> >> > want of generating unique ids works (for example you could use
> >> >> UUID's)
> >> >> >> >
> >> >> >> > regards
> >> >> >> > deepak
> >> >> >> >
> >> >> >> > On Tue, Jun 1, 2010 at 4:42 PM, virkenator <
> virkenator@gmail.com>
> >> >> >> wrote:
> >> >> >> >
> >> >> >> >>
> >> >> >> >> I am a newbie. I am using JMeter to test registration form
> based
> >> >> >> >> software.
> >> >> >> >> Here's my scenario:
> >> >> >> >>
> >> >> >> >> A user logs in and adds a patient in database. I am able to
> >> >> automate
> >> >> >> this
> >> >> >> >> process by recording it, however I want to automate the add
> >> patient
> >> >> >> >> scenario, since a unique patient id is required to add a
> patient
> >> >> and
> >> >> >> save
> >> >> >> >> it
> >> >> >> >> on the database. The procedure I am following right now is
> >> manually
> >> >> >> >> entering
> >> >> >> >> ids and then running the automated script, which is not putting
> >> any
> >> >> >> load
> >> >> >> >> or
> >> >> >> >> stress on the site.
> >> >> >> >> If somebody could please tell me how to generate unique ids and
> >> how
> >> >> to
> >> >> >> >> fit
> >> >> >> >> this procedure in already working script or how to increment
> >> >> previous
> >> >> >> id
> >> >> >> >> whenever the script is run.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28748660.html
> >> >> >> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> >> >> To unsubscribe, e-mail:
> >> jmeter-user-unsubscribe@jakarta.apache.org
> >> >> >> >> For additional commands, e-mail:
> >> >> jmeter-user-help@jakarta.apache.org
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> >>
> >>
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28758835.html
> >> >> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail:
> jmeter-user-unsubscribe@jakarta.apache.org
> >> >> >> For additional commands, e-mail:
> >> jmeter-user-help@jakarta.apache.org
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28760496.html
> >> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28760937.html
> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28761306.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: how to generate unique ids in jmeter

Posted by virkenator <vi...@gmail.com>.
Hi,

I totally agree with you that, to generate a random value is more beneficial
than incrementing the previous one.
My application can handle any type of string. If you could please help me
figure out, how to create/generate random values and how to append them in
the script, I would highly appreciate.

Deepak Shetty wrote:
> 
> Hi
> Either you use an incremented variable in which case you will have to
> maintain what was the last used value (or atleast retrieve it) or you can
> use any random value (So long as it is unique), the latter is easier
> because
> you dont need to care about the previously used values (or even running it
> across multiple machines), any new value is always  unique (however by
> nature these are strings and your application may not be able to handle
> strings). So the question is can your application handle any unique string
> or not?
> 
> If you need to use a numeric value then use a counter as mentioned
> previously. How you get the value to add the counter to depends on your
> app.
> You can do this outside of JMeter and pass it to Jmeter as a property ,
> you
> can have a setup thread group in Jmeter which for e.g. reads from a
> database
> the max value and sets that into a property or you can read the value from
> a
> file and at the end of the test update that file
> 
> If you have to distribute the test across machines then auto increment
> will
> be tougher to manage.
> 
> regards
> deepak
> 
> 
> 
> On Wed, Jun 2, 2010 at 3:17 PM, virkenator <vi...@gmail.com> wrote:
> 
>>
>> No, not a token but an incremented value for the field, so that i dont
>> have
>> to increment it manually. Because once the script is run, it can not be
>> re-run with same value for the field.
>> That ways, the script will add patients automatically depending on the
>> number of loops specified.
>> I hope, I am understandable.
>>
>> Deepak Shetty wrote:
>> >
>> > so you actually want an incremented numeric field only? Not a unique
>> token
>> > ?
>> >
>> > regards
>> > deepak
>> >
>> > On Wed, Jun 2, 2010 at 2:33 PM, virkenator <vi...@gmail.com>
>> wrote:
>> >
>> >>
>> >> Hello Deepak,
>> >>
>> >> Thank you replying.
>> >> Patient t ID is a mandatory field in the form, and it has to be
>> >> unique/different from IDs already entered/existing in the form
>> database,
>> >> that is why user has to specify id every time he/she wants to save the
>> >> form
>> >> and if it is not different/unique from already existing one, the form
>> >> will
>> >> not get saved.
>> >> However, the script will run just fine.
>> >>
>> >> Deepak Shetty wrote:
>> >> >
>> >> > First i dont quite think your description is accurate since Id find
>> it
>> >> > hard
>> >> > to believe that your application asks the user who's entering
>> >> information
>> >> > into the form to generate the unique Id.  So if I access your
>> >> application
>> >> > in
>> >> > a browser do i have to enter a unique patient id?
>> >> >
>> >> > For the moment Assuming  that your problem is what you state it is
>> >> >
>> >> >
>> >> > Thread Group
>> >> > +Req1
>> >> > +Req2
>> >> > +Req3 (specify the below as name/value)
>> >> > ++patientId   Patient_${__threadNum()}_${currentTime}
>> >> > ++ other parameters
>> >> > +Req4
>> >> > +User Parameters ( update once per iteration checked with the
>> following
>> >> > variable)
>> >> > ++currentTime ${__time(YMD)}${__time(HMS)
>> >> >
>> >> > Then add a view results tree listener , and in the request tab you
>> can
>> >> see
>> >> > that you are posting unique values for patientId every time
>> >> > Your test may still not work , but the problem wont be the
>> generation
>> >> of
>> >> > unique value.
>> >> >
>> >> >
>> >> > If you want an autoincrementing scheme then you need to use
>> >> >
>> >>
>> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Counterplus
>> >> > beanshell to track the last used counter number from a previous test
>> >> > run or you can code it in beanshell/java
>> >> >
>> >> > regards
>> >> > deepak
>> >> >
>> >> > On Wed, Jun 2, 2010 at 12:12 PM, virkenator <vi...@gmail.com>
>> >> wrote:
>> >> >
>> >> >>
>> >> >> Hi Deepak,
>> >> >>
>> >> >> Thank you for the help. I tried it, but in vain. May be I need to
>> >> explain
>> >> >> you more details. When I create a patient, that data needs to be
>> >> posted
>> >> >> through the HTTP request to the server.
>> >> >> Here is how my script works.
>> >> >> 1. A user logs in
>> >> >> 2. Goes to the patient registration form.
>> >> >> 3. Adds patient id, which has to be unique every time patient needs
>> to
>> >> be
>> >> >> added.
>> >> >> 4. Saves the form and logs out.
>> >> >> This script has all the HTTP requests. During the step 3, there are
>> >> two
>> >> >> fields(patient id and patientkey) which need to be edited (which I
>> am
>> >> >> presently editing manually) and posted as the HTTP request for step
>> 3.
>> >> >> I am wondering is there any way, I can increment or create unique
>> >> values
>> >> >> for
>> >> >> these two fields and then POST them as a HTTP request
>> automatically.
>> >> >>
>> >> >> Deepak Shetty wrote:
>> >> >> >
>> >> >> > This is one way
>> >> >> > add a User Parameters , just one user will do,  specify the name
>> >> like
>> >> >> > currentTime and value like ${__time(YMD)}${__time(HMS) . Also
>> check
>> >> >> update
>> >> >> > once per iteration (basically generating a timestamp , you can
>> use
>> >> >> other
>> >> >> > ways to generate a timestamp too , the reason I do it this way is
>> >> that
>> >> >> I
>> >> >> > need this value for multiple samplers)
>> >> >> > Then when you need to post a unique data element, you can provide
>> a
>> >> >> value
>> >> >> > like
>> >> >> > ${userIdPrefix}_${__threadNum()}_${currentTime}
>> >> >> >
>> >> >> > where userIdPrefix is a variable normally defined as
>> >> JMeterCreatedUser
>> >> >> or
>> >> >> > something .
>> >> >> >
>> >> >> > Note that because JMeter can call javascript or even Java/BSH any
>> >> >> method
>> >> >> > you
>> >> >> > want of generating unique ids works (for example you could use
>> >> UUID's)
>> >> >> >
>> >> >> > regards
>> >> >> > deepak
>> >> >> >
>> >> >> > On Tue, Jun 1, 2010 at 4:42 PM, virkenator <vi...@gmail.com>
>> >> >> wrote:
>> >> >> >
>> >> >> >>
>> >> >> >> I am a newbie. I am using JMeter to test registration form based
>> >> >> >> software.
>> >> >> >> Here's my scenario:
>> >> >> >>
>> >> >> >> A user logs in and adds a patient in database. I am able to
>> >> automate
>> >> >> this
>> >> >> >> process by recording it, however I want to automate the add
>> patient
>> >> >> >> scenario, since a unique patient id is required to add a patient
>> >> and
>> >> >> save
>> >> >> >> it
>> >> >> >> on the database. The procedure I am following right now is
>> manually
>> >> >> >> entering
>> >> >> >> ids and then running the automated script, which is not putting
>> any
>> >> >> load
>> >> >> >> or
>> >> >> >> stress on the site.
>> >> >> >> If somebody could please tell me how to generate unique ids and
>> how
>> >> to
>> >> >> >> fit
>> >> >> >> this procedure in already working script or how to increment
>> >> previous
>> >> >> id
>> >> >> >> whenever the script is run.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> >>
>> >>
>> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28748660.html
>> >> >> >> Sent from the JMeter - User mailing list archive at Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail:
>> jmeter-user-unsubscribe@jakarta.apache.org
>> >> >> >> For additional commands, e-mail:
>> >> jmeter-user-help@jakarta.apache.org
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28758835.html
>> >> >> Sent from the JMeter - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> >> >> For additional commands, e-mail:
>> jmeter-user-help@jakarta.apache.org
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28760496.html
>> >> Sent from the JMeter - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28760937.html
>> Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28761306.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: how to generate unique ids in jmeter

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
Either you use an incremented variable in which case you will have to
maintain what was the last used value (or atleast retrieve it) or you can
use any random value (So long as it is unique), the latter is easier because
you dont need to care about the previously used values (or even running it
across multiple machines), any new value is always  unique (however by
nature these are strings and your application may not be able to handle
strings). So the question is can your application handle any unique string
or not?

If you need to use a numeric value then use a counter as mentioned
previously. How you get the value to add the counter to depends on your app.
You can do this outside of JMeter and pass it to Jmeter as a property , you
can have a setup thread group in Jmeter which for e.g. reads from a database
the max value and sets that into a property or you can read the value from a
file and at the end of the test update that file

If you have to distribute the test across machines then auto increment will
be tougher to manage.

regards
deepak



On Wed, Jun 2, 2010 at 3:17 PM, virkenator <vi...@gmail.com> wrote:

>
> No, not a token but an incremented value for the field, so that i dont have
> to increment it manually. Because once the script is run, it can not be
> re-run with same value for the field.
> That ways, the script will add patients automatically depending on the
> number of loops specified.
> I hope, I am understandable.
>
> Deepak Shetty wrote:
> >
> > so you actually want an incremented numeric field only? Not a unique
> token
> > ?
> >
> > regards
> > deepak
> >
> > On Wed, Jun 2, 2010 at 2:33 PM, virkenator <vi...@gmail.com> wrote:
> >
> >>
> >> Hello Deepak,
> >>
> >> Thank you replying.
> >> Patient t ID is a mandatory field in the form, and it has to be
> >> unique/different from IDs already entered/existing in the form database,
> >> that is why user has to specify id every time he/she wants to save the
> >> form
> >> and if it is not different/unique from already existing one, the form
> >> will
> >> not get saved.
> >> However, the script will run just fine.
> >>
> >> Deepak Shetty wrote:
> >> >
> >> > First i dont quite think your description is accurate since Id find it
> >> > hard
> >> > to believe that your application asks the user who's entering
> >> information
> >> > into the form to generate the unique Id.  So if I access your
> >> application
> >> > in
> >> > a browser do i have to enter a unique patient id?
> >> >
> >> > For the moment Assuming  that your problem is what you state it is
> >> >
> >> >
> >> > Thread Group
> >> > +Req1
> >> > +Req2
> >> > +Req3 (specify the below as name/value)
> >> > ++patientId   Patient_${__threadNum()}_${currentTime}
> >> > ++ other parameters
> >> > +Req4
> >> > +User Parameters ( update once per iteration checked with the
> following
> >> > variable)
> >> > ++currentTime ${__time(YMD)}${__time(HMS)
> >> >
> >> > Then add a view results tree listener , and in the request tab you can
> >> see
> >> > that you are posting unique values for patientId every time
> >> > Your test may still not work , but the problem wont be the generation
> >> of
> >> > unique value.
> >> >
> >> >
> >> > If you want an autoincrementing scheme then you need to use
> >> >
> >>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Counterplus
> >> > beanshell to track the last used counter number from a previous test
> >> > run or you can code it in beanshell/java
> >> >
> >> > regards
> >> > deepak
> >> >
> >> > On Wed, Jun 2, 2010 at 12:12 PM, virkenator <vi...@gmail.com>
> >> wrote:
> >> >
> >> >>
> >> >> Hi Deepak,
> >> >>
> >> >> Thank you for the help. I tried it, but in vain. May be I need to
> >> explain
> >> >> you more details. When I create a patient, that data needs to be
> >> posted
> >> >> through the HTTP request to the server.
> >> >> Here is how my script works.
> >> >> 1. A user logs in
> >> >> 2. Goes to the patient registration form.
> >> >> 3. Adds patient id, which has to be unique every time patient needs
> to
> >> be
> >> >> added.
> >> >> 4. Saves the form and logs out.
> >> >> This script has all the HTTP requests. During the step 3, there are
> >> two
> >> >> fields(patient id and patientkey) which need to be edited (which I am
> >> >> presently editing manually) and posted as the HTTP request for step
> 3.
> >> >> I am wondering is there any way, I can increment or create unique
> >> values
> >> >> for
> >> >> these two fields and then POST them as a HTTP request automatically.
> >> >>
> >> >> Deepak Shetty wrote:
> >> >> >
> >> >> > This is one way
> >> >> > add a User Parameters , just one user will do,  specify the name
> >> like
> >> >> > currentTime and value like ${__time(YMD)}${__time(HMS) . Also check
> >> >> update
> >> >> > once per iteration (basically generating a timestamp , you can use
> >> >> other
> >> >> > ways to generate a timestamp too , the reason I do it this way is
> >> that
> >> >> I
> >> >> > need this value for multiple samplers)
> >> >> > Then when you need to post a unique data element, you can provide a
> >> >> value
> >> >> > like
> >> >> > ${userIdPrefix}_${__threadNum()}_${currentTime}
> >> >> >
> >> >> > where userIdPrefix is a variable normally defined as
> >> JMeterCreatedUser
> >> >> or
> >> >> > something .
> >> >> >
> >> >> > Note that because JMeter can call javascript or even Java/BSH any
> >> >> method
> >> >> > you
> >> >> > want of generating unique ids works (for example you could use
> >> UUID's)
> >> >> >
> >> >> > regards
> >> >> > deepak
> >> >> >
> >> >> > On Tue, Jun 1, 2010 at 4:42 PM, virkenator <vi...@gmail.com>
> >> >> wrote:
> >> >> >
> >> >> >>
> >> >> >> I am a newbie. I am using JMeter to test registration form based
> >> >> >> software.
> >> >> >> Here's my scenario:
> >> >> >>
> >> >> >> A user logs in and adds a patient in database. I am able to
> >> automate
> >> >> this
> >> >> >> process by recording it, however I want to automate the add
> patient
> >> >> >> scenario, since a unique patient id is required to add a patient
> >> and
> >> >> save
> >> >> >> it
> >> >> >> on the database. The procedure I am following right now is
> manually
> >> >> >> entering
> >> >> >> ids and then running the automated script, which is not putting
> any
> >> >> load
> >> >> >> or
> >> >> >> stress on the site.
> >> >> >> If somebody could please tell me how to generate unique ids and
> how
> >> to
> >> >> >> fit
> >> >> >> this procedure in already working script or how to increment
> >> previous
> >> >> id
> >> >> >> whenever the script is run.
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> >>
> >>
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28748660.html
> >> >> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail:
> jmeter-user-unsubscribe@jakarta.apache.org
> >> >> >> For additional commands, e-mail:
> >> jmeter-user-help@jakarta.apache.org
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28758835.html
> >> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28760496.html
> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28760937.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: how to generate unique ids in jmeter

Posted by virkenator <vi...@gmail.com>.
No, not a token but an incremented value for the field, so that i dont have
to increment it manually. Because once the script is run, it can not be
re-run with same value for the field. 
That ways, the script will add patients automatically depending on the
number of loops specified.
I hope, I am understandable.

Deepak Shetty wrote:
> 
> so you actually want an incremented numeric field only? Not a unique token
> ?
> 
> regards
> deepak
> 
> On Wed, Jun 2, 2010 at 2:33 PM, virkenator <vi...@gmail.com> wrote:
> 
>>
>> Hello Deepak,
>>
>> Thank you replying.
>> Patient t ID is a mandatory field in the form, and it has to be
>> unique/different from IDs already entered/existing in the form database,
>> that is why user has to specify id every time he/she wants to save the
>> form
>> and if it is not different/unique from already existing one, the form
>> will
>> not get saved.
>> However, the script will run just fine.
>>
>> Deepak Shetty wrote:
>> >
>> > First i dont quite think your description is accurate since Id find it
>> > hard
>> > to believe that your application asks the user who's entering
>> information
>> > into the form to generate the unique Id.  So if I access your
>> application
>> > in
>> > a browser do i have to enter a unique patient id?
>> >
>> > For the moment Assuming  that your problem is what you state it is
>> >
>> >
>> > Thread Group
>> > +Req1
>> > +Req2
>> > +Req3 (specify the below as name/value)
>> > ++patientId   Patient_${__threadNum()}_${currentTime}
>> > ++ other parameters
>> > +Req4
>> > +User Parameters ( update once per iteration checked with the following
>> > variable)
>> > ++currentTime ${__time(YMD)}${__time(HMS)
>> >
>> > Then add a view results tree listener , and in the request tab you can
>> see
>> > that you are posting unique values for patientId every time
>> > Your test may still not work , but the problem wont be the generation
>> of
>> > unique value.
>> >
>> >
>> > If you want an autoincrementing scheme then you need to use
>> >
>> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Counterplus
>> > beanshell to track the last used counter number from a previous test
>> > run or you can code it in beanshell/java
>> >
>> > regards
>> > deepak
>> >
>> > On Wed, Jun 2, 2010 at 12:12 PM, virkenator <vi...@gmail.com>
>> wrote:
>> >
>> >>
>> >> Hi Deepak,
>> >>
>> >> Thank you for the help. I tried it, but in vain. May be I need to
>> explain
>> >> you more details. When I create a patient, that data needs to be
>> posted
>> >> through the HTTP request to the server.
>> >> Here is how my script works.
>> >> 1. A user logs in
>> >> 2. Goes to the patient registration form.
>> >> 3. Adds patient id, which has to be unique every time patient needs to
>> be
>> >> added.
>> >> 4. Saves the form and logs out.
>> >> This script has all the HTTP requests. During the step 3, there are
>> two
>> >> fields(patient id and patientkey) which need to be edited (which I am
>> >> presently editing manually) and posted as the HTTP request for step 3.
>> >> I am wondering is there any way, I can increment or create unique
>> values
>> >> for
>> >> these two fields and then POST them as a HTTP request automatically.
>> >>
>> >> Deepak Shetty wrote:
>> >> >
>> >> > This is one way
>> >> > add a User Parameters , just one user will do,  specify the name
>> like
>> >> > currentTime and value like ${__time(YMD)}${__time(HMS) . Also check
>> >> update
>> >> > once per iteration (basically generating a timestamp , you can use
>> >> other
>> >> > ways to generate a timestamp too , the reason I do it this way is
>> that
>> >> I
>> >> > need this value for multiple samplers)
>> >> > Then when you need to post a unique data element, you can provide a
>> >> value
>> >> > like
>> >> > ${userIdPrefix}_${__threadNum()}_${currentTime}
>> >> >
>> >> > where userIdPrefix is a variable normally defined as
>> JMeterCreatedUser
>> >> or
>> >> > something .
>> >> >
>> >> > Note that because JMeter can call javascript or even Java/BSH any
>> >> method
>> >> > you
>> >> > want of generating unique ids works (for example you could use
>> UUID's)
>> >> >
>> >> > regards
>> >> > deepak
>> >> >
>> >> > On Tue, Jun 1, 2010 at 4:42 PM, virkenator <vi...@gmail.com>
>> >> wrote:
>> >> >
>> >> >>
>> >> >> I am a newbie. I am using JMeter to test registration form based
>> >> >> software.
>> >> >> Here's my scenario:
>> >> >>
>> >> >> A user logs in and adds a patient in database. I am able to
>> automate
>> >> this
>> >> >> process by recording it, however I want to automate the add patient
>> >> >> scenario, since a unique patient id is required to add a patient
>> and
>> >> save
>> >> >> it
>> >> >> on the database. The procedure I am following right now is manually
>> >> >> entering
>> >> >> ids and then running the automated script, which is not putting any
>> >> load
>> >> >> or
>> >> >> stress on the site.
>> >> >> If somebody could please tell me how to generate unique ids and how
>> to
>> >> >> fit
>> >> >> this procedure in already working script or how to increment
>> previous
>> >> id
>> >> >> whenever the script is run.
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28748660.html
>> >> >> Sent from the JMeter - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> >> >> For additional commands, e-mail:
>> jmeter-user-help@jakarta.apache.org
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28758835.html
>> >> Sent from the JMeter - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28760496.html
>> Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28760937.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: how to generate unique ids in jmeter

Posted by Deepak Shetty <sh...@gmail.com>.
so you actually want an incremented numeric field only? Not a unique token ?

regards
deepak

On Wed, Jun 2, 2010 at 2:33 PM, virkenator <vi...@gmail.com> wrote:

>
> Hello Deepak,
>
> Thank you replying.
> Patient t ID is a mandatory field in the form, and it has to be
> unique/different from IDs already entered/existing in the form database,
> that is why user has to specify id every time he/she wants to save the form
> and if it is not different/unique from already existing one, the form will
> not get saved.
> However, the script will run just fine.
>
> Deepak Shetty wrote:
> >
> > First i dont quite think your description is accurate since Id find it
> > hard
> > to believe that your application asks the user who's entering information
> > into the form to generate the unique Id.  So if I access your application
> > in
> > a browser do i have to enter a unique patient id?
> >
> > For the moment Assuming  that your problem is what you state it is
> >
> >
> > Thread Group
> > +Req1
> > +Req2
> > +Req3 (specify the below as name/value)
> > ++patientId   Patient_${__threadNum()}_${currentTime}
> > ++ other parameters
> > +Req4
> > +User Parameters ( update once per iteration checked with the following
> > variable)
> > ++currentTime ${__time(YMD)}${__time(HMS)
> >
> > Then add a view results tree listener , and in the request tab you can
> see
> > that you are posting unique values for patientId every time
> > Your test may still not work , but the problem wont be the generation of
> > unique value.
> >
> >
> > If you want an autoincrementing scheme then you need to use
> >
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Counterplus
> > beanshell to track the last used counter number from a previous test
> > run or you can code it in beanshell/java
> >
> > regards
> > deepak
> >
> > On Wed, Jun 2, 2010 at 12:12 PM, virkenator <vi...@gmail.com>
> wrote:
> >
> >>
> >> Hi Deepak,
> >>
> >> Thank you for the help. I tried it, but in vain. May be I need to
> explain
> >> you more details. When I create a patient, that data needs to be posted
> >> through the HTTP request to the server.
> >> Here is how my script works.
> >> 1. A user logs in
> >> 2. Goes to the patient registration form.
> >> 3. Adds patient id, which has to be unique every time patient needs to
> be
> >> added.
> >> 4. Saves the form and logs out.
> >> This script has all the HTTP requests. During the step 3, there are two
> >> fields(patient id and patientkey) which need to be edited (which I am
> >> presently editing manually) and posted as the HTTP request for step 3.
> >> I am wondering is there any way, I can increment or create unique values
> >> for
> >> these two fields and then POST them as a HTTP request automatically.
> >>
> >> Deepak Shetty wrote:
> >> >
> >> > This is one way
> >> > add a User Parameters , just one user will do,  specify the name like
> >> > currentTime and value like ${__time(YMD)}${__time(HMS) . Also check
> >> update
> >> > once per iteration (basically generating a timestamp , you can use
> >> other
> >> > ways to generate a timestamp too , the reason I do it this way is that
> >> I
> >> > need this value for multiple samplers)
> >> > Then when you need to post a unique data element, you can provide a
> >> value
> >> > like
> >> > ${userIdPrefix}_${__threadNum()}_${currentTime}
> >> >
> >> > where userIdPrefix is a variable normally defined as JMeterCreatedUser
> >> or
> >> > something .
> >> >
> >> > Note that because JMeter can call javascript or even Java/BSH any
> >> method
> >> > you
> >> > want of generating unique ids works (for example you could use UUID's)
> >> >
> >> > regards
> >> > deepak
> >> >
> >> > On Tue, Jun 1, 2010 at 4:42 PM, virkenator <vi...@gmail.com>
> >> wrote:
> >> >
> >> >>
> >> >> I am a newbie. I am using JMeter to test registration form based
> >> >> software.
> >> >> Here's my scenario:
> >> >>
> >> >> A user logs in and adds a patient in database. I am able to automate
> >> this
> >> >> process by recording it, however I want to automate the add patient
> >> >> scenario, since a unique patient id is required to add a patient and
> >> save
> >> >> it
> >> >> on the database. The procedure I am following right now is manually
> >> >> entering
> >> >> ids and then running the automated script, which is not putting any
> >> load
> >> >> or
> >> >> stress on the site.
> >> >> If somebody could please tell me how to generate unique ids and how
> to
> >> >> fit
> >> >> this procedure in already working script or how to increment previous
> >> id
> >> >> whenever the script is run.
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28748660.html
> >> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28758835.html
> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28760496.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: how to generate unique ids in jmeter

Posted by virkenator <vi...@gmail.com>.
Hello Deepak,

Thank you replying. 
Patient t ID is a mandatory field in the form, and it has to be
unique/different from IDs already entered/existing in the form database,
that is why user has to specify id every time he/she wants to save the form
and if it is not different/unique from already existing one, the form will
not get saved.
However, the script will run just fine.

Deepak Shetty wrote:
> 
> First i dont quite think your description is accurate since Id find it
> hard
> to believe that your application asks the user who's entering information
> into the form to generate the unique Id.  So if I access your application
> in
> a browser do i have to enter a unique patient id?
> 
> For the moment Assuming  that your problem is what you state it is
> 
> 
> Thread Group
> +Req1
> +Req2
> +Req3 (specify the below as name/value)
> ++patientId   Patient_${__threadNum()}_${currentTime}
> ++ other parameters
> +Req4
> +User Parameters ( update once per iteration checked with the following
> variable)
> ++currentTime ${__time(YMD)}${__time(HMS)
> 
> Then add a view results tree listener , and in the request tab you can see
> that you are posting unique values for patientId every time
> Your test may still not work , but the problem wont be the generation of
> unique value.
> 
> 
> If you want an autoincrementing scheme then you need to use
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Counterplus
> beanshell to track the last used counter number from a previous test
> run or you can code it in beanshell/java
> 
> regards
> deepak
> 
> On Wed, Jun 2, 2010 at 12:12 PM, virkenator <vi...@gmail.com> wrote:
> 
>>
>> Hi Deepak,
>>
>> Thank you for the help. I tried it, but in vain. May be I need to explain
>> you more details. When I create a patient, that data needs to be posted
>> through the HTTP request to the server.
>> Here is how my script works.
>> 1. A user logs in
>> 2. Goes to the patient registration form.
>> 3. Adds patient id, which has to be unique every time patient needs to be
>> added.
>> 4. Saves the form and logs out.
>> This script has all the HTTP requests. During the step 3, there are two
>> fields(patient id and patientkey) which need to be edited (which I am
>> presently editing manually) and posted as the HTTP request for step 3.
>> I am wondering is there any way, I can increment or create unique values
>> for
>> these two fields and then POST them as a HTTP request automatically.
>>
>> Deepak Shetty wrote:
>> >
>> > This is one way
>> > add a User Parameters , just one user will do,  specify the name like
>> > currentTime and value like ${__time(YMD)}${__time(HMS) . Also check
>> update
>> > once per iteration (basically generating a timestamp , you can use
>> other
>> > ways to generate a timestamp too , the reason I do it this way is that
>> I
>> > need this value for multiple samplers)
>> > Then when you need to post a unique data element, you can provide a
>> value
>> > like
>> > ${userIdPrefix}_${__threadNum()}_${currentTime}
>> >
>> > where userIdPrefix is a variable normally defined as JMeterCreatedUser
>> or
>> > something .
>> >
>> > Note that because JMeter can call javascript or even Java/BSH any
>> method
>> > you
>> > want of generating unique ids works (for example you could use UUID's)
>> >
>> > regards
>> > deepak
>> >
>> > On Tue, Jun 1, 2010 at 4:42 PM, virkenator <vi...@gmail.com>
>> wrote:
>> >
>> >>
>> >> I am a newbie. I am using JMeter to test registration form based
>> >> software.
>> >> Here's my scenario:
>> >>
>> >> A user logs in and adds a patient in database. I am able to automate
>> this
>> >> process by recording it, however I want to automate the add patient
>> >> scenario, since a unique patient id is required to add a patient and
>> save
>> >> it
>> >> on the database. The procedure I am following right now is manually
>> >> entering
>> >> ids and then running the automated script, which is not putting any
>> load
>> >> or
>> >> stress on the site.
>> >> If somebody could please tell me how to generate unique ids and how to
>> >> fit
>> >> this procedure in already working script or how to increment previous
>> id
>> >> whenever the script is run.
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28748660.html
>> >> Sent from the JMeter - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28758835.html
>> Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28760496.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: how to generate unique ids in jmeter

Posted by Deepak Shetty <sh...@gmail.com>.
First i dont quite think your description is accurate since Id find it hard
to believe that your application asks the user who's entering information
into the form to generate the unique Id.  So if I access your application in
a browser do i have to enter a unique patient id?

For the moment Assuming  that your problem is what you state it is


Thread Group
+Req1
+Req2
+Req3 (specify the below as name/value)
++patientId   Patient_${__threadNum()}_${currentTime}
++ other parameters
+Req4
+User Parameters ( update once per iteration checked with the following
variable)
++currentTime ${__time(YMD)}${__time(HMS)

Then add a view results tree listener , and in the request tab you can see
that you are posting unique values for patientId every time
Your test may still not work , but the problem wont be the generation of
unique value.


If you want an autoincrementing scheme then you need to use
http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Counterplus
beanshell to track the last used counter number from a previous test
run or you can code it in beanshell/java

regards
deepak

On Wed, Jun 2, 2010 at 12:12 PM, virkenator <vi...@gmail.com> wrote:

>
> Hi Deepak,
>
> Thank you for the help. I tried it, but in vain. May be I need to explain
> you more details. When I create a patient, that data needs to be posted
> through the HTTP request to the server.
> Here is how my script works.
> 1. A user logs in
> 2. Goes to the patient registration form.
> 3. Adds patient id, which has to be unique every time patient needs to be
> added.
> 4. Saves the form and logs out.
> This script has all the HTTP requests. During the step 3, there are two
> fields(patient id and patientkey) which need to be edited (which I am
> presently editing manually) and posted as the HTTP request for step 3.
> I am wondering is there any way, I can increment or create unique values
> for
> these two fields and then POST them as a HTTP request automatically.
>
> Deepak Shetty wrote:
> >
> > This is one way
> > add a User Parameters , just one user will do,  specify the name like
> > currentTime and value like ${__time(YMD)}${__time(HMS) . Also check
> update
> > once per iteration (basically generating a timestamp , you can use other
> > ways to generate a timestamp too , the reason I do it this way is that I
> > need this value for multiple samplers)
> > Then when you need to post a unique data element, you can provide a value
> > like
> > ${userIdPrefix}_${__threadNum()}_${currentTime}
> >
> > where userIdPrefix is a variable normally defined as JMeterCreatedUser or
> > something .
> >
> > Note that because JMeter can call javascript or even Java/BSH any method
> > you
> > want of generating unique ids works (for example you could use UUID's)
> >
> > regards
> > deepak
> >
> > On Tue, Jun 1, 2010 at 4:42 PM, virkenator <vi...@gmail.com> wrote:
> >
> >>
> >> I am a newbie. I am using JMeter to test registration form based
> >> software.
> >> Here's my scenario:
> >>
> >> A user logs in and adds a patient in database. I am able to automate
> this
> >> process by recording it, however I want to automate the add patient
> >> scenario, since a unique patient id is required to add a patient and
> save
> >> it
> >> on the database. The procedure I am following right now is manually
> >> entering
> >> ids and then running the automated script, which is not putting any load
> >> or
> >> stress on the site.
> >> If somebody could please tell me how to generate unique ids and how to
> >> fit
> >> this procedure in already working script or how to increment previous id
> >> whenever the script is run.
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28748660.html
> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28758835.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: how to generate unique ids in jmeter

Posted by virkenator <vi...@gmail.com>.
Hi Deepak,

Thank you for the help. I tried it, but in vain. May be I need to explain
you more details. When I create a patient, that data needs to be posted
through the HTTP request to the server.
Here is how my script works.
1. A user logs in
2. Goes to the patient registration form.
3. Adds patient id, which has to be unique every time patient needs to be
added.
4. Saves the form and logs out.
This script has all the HTTP requests. During the step 3, there are two
fields(patient id and patientkey) which need to be edited (which I am
presently editing manually) and posted as the HTTP request for step 3.
I am wondering is there any way, I can increment or create unique values for
these two fields and then POST them as a HTTP request automatically. 

Deepak Shetty wrote:
> 
> This is one way
> add a User Parameters , just one user will do,  specify the name like
> currentTime and value like ${__time(YMD)}${__time(HMS) . Also check update
> once per iteration (basically generating a timestamp , you can use other
> ways to generate a timestamp too , the reason I do it this way is that I
> need this value for multiple samplers)
> Then when you need to post a unique data element, you can provide a value
> like
> ${userIdPrefix}_${__threadNum()}_${currentTime}
> 
> where userIdPrefix is a variable normally defined as JMeterCreatedUser or
> something .
> 
> Note that because JMeter can call javascript or even Java/BSH any method
> you
> want of generating unique ids works (for example you could use UUID's)
> 
> regards
> deepak
> 
> On Tue, Jun 1, 2010 at 4:42 PM, virkenator <vi...@gmail.com> wrote:
> 
>>
>> I am a newbie. I am using JMeter to test registration form based
>> software.
>> Here's my scenario:
>>
>> A user logs in and adds a patient in database. I am able to automate this
>> process by recording it, however I want to automate the add patient
>> scenario, since a unique patient id is required to add a patient and save
>> it
>> on the database. The procedure I am following right now is manually
>> entering
>> ids and then running the automated script, which is not putting any load
>> or
>> stress on the site.
>> If somebody could please tell me how to generate unique ids and how to
>> fit
>> this procedure in already working script or how to increment previous id
>> whenever the script is run.
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28748660.html
>> Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28758835.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: how to generate unique ids in jmeter

Posted by Deepak Shetty <sh...@gmail.com>.
This is one way
add a User Parameters , just one user will do,  specify the name like
currentTime and value like ${__time(YMD)}${__time(HMS) . Also check update
once per iteration (basically generating a timestamp , you can use other
ways to generate a timestamp too , the reason I do it this way is that I
need this value for multiple samplers)
Then when you need to post a unique data element, you can provide a value
like
${userIdPrefix}_${__threadNum()}_${currentTime}

where userIdPrefix is a variable normally defined as JMeterCreatedUser or
something .

Note that because JMeter can call javascript or even Java/BSH any method you
want of generating unique ids works (for example you could use UUID's)

regards
deepak

On Tue, Jun 1, 2010 at 4:42 PM, virkenator <vi...@gmail.com> wrote:

>
> I am a newbie. I am using JMeter to test registration form based software.
> Here's my scenario:
>
> A user logs in and adds a patient in database. I am able to automate this
> process by recording it, however I want to automate the add patient
> scenario, since a unique patient id is required to add a patient and save
> it
> on the database. The procedure I am following right now is manually
> entering
> ids and then running the automated script, which is not putting any load or
> stress on the site.
> If somebody could please tell me how to generate unique ids and how to fit
> this procedure in already working script or how to increment previous id
> whenever the script is run.
>
>
>
>
> --
> View this message in context:
> http://old.nabble.com/how-to-generate-unique-ids-in-jmeter-tp28748660p28748660.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>