You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Meenakshi Sharma <me...@gmail.com> on 2016/02/23 23:45:50 UTC

Dynamic Path

Hi,

I am trying to create load tests. The url looks like this:
http://test.com/items/1/data

I want to dynamically create item id (1,2,3..) so that it creates new path
by changing item id.

I tried using CSV Data Set config and added 'id' as variable.
Also added 'id' as parameter in HTTP request which is wrong as it is
leading to following path:
http://test.com/items/{id}/data?id={id}

Could someone point out what should I try.

Thanks,
Meena

Re: Dynamic Path

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
Variables are referenced as ${id} - your example shows {id}
Also put a Debug Sampler and add a view results tree listener - you should
be able to see if you are reading your CSV correctly - if not then check
jmeter.log - there is probably an error

On Tue, Feb 23, 2016 at 2:45 PM, Meenakshi Sharma <me...@gmail.com>
wrote:

> Hi,
>
> I am trying to create load tests. The url looks like this:
> http://test.com/items/1/data
>
> I want to dynamically create item id (1,2,3..) so that it creates new path
> by changing item id.
>
> I tried using CSV Data Set config and added 'id' as variable.
> Also added 'id' as parameter in HTTP request which is wrong as it is
> leading to following path:
> http://test.com/items/{id}/data?id={id}
>
> Could someone point out what should I try.
>
> Thanks,
> Meena
>

Re: Dynamic Path

Posted by Meenakshi Sharma <me...@gmail.com>.
Great. fixed it.
Thank you everyone.

On Wed, Feb 24, 2016 at 12:36 PM, Deepak Shetty <sh...@gmail.com> wrote:

> The problem you are seeing is you are asking jmeter to use the value of a
> variable named key ${key} - but JMeter cannot find a variable with that
> name (And so it just sends ${key}
> The question is where is this variable being defined? - And as before put
> in a debug sampler + view results tree listener so that you can see whether
> or not the variable is  getting set
> (You also do not seem to be doping a POST if you are showing parameters in
> the URL)
>
> On Wed, Feb 24, 2016 at 9:04 AM, Meenakshi Sharma <me...@gmail.com>
> wrote:
>
> > Hi
> >
> > Thank you Deepak and Rodrigo!
> > I was able to fix the path from your suggestion.
> >
> > I am now able to do a GET from http://test.com/items/${id}/data
> > <http://test.com/items/%7Bid%7D/data?id=%7Bid%7D>
> > but not POST using http://test.com/items/${id}/data?value=2&key=${key}
> > <http://test.com/items/%7Bid%7D/data?id=%7Bid%7D>
> >
> > The variable ${key} is not being evaluated and I am getting invalid uri
> > error.
> > Any ideas?
> >
> > Thanks!
> >
> > On Tue, Feb 23, 2016 at 6:16 PM, Rodrigo Ramos <
> rodrigo.ramos.go@gmail.com
> > >
> > wrote:
> >
> > > As says Deepak, in JMeter the variables are referenced like in Unix.
> > Form:
> > >  ${VARIABLE}.
> > >
> > > 2016-02-23 16:58 GMT-06:00 Meenakshi Sharma <me...@gmail.com>:
> > >
> > > > hi
> > > >
> > > > The id is not server response. It refers to different items
> > > > For example, shopping list can have several items with different ids.
> > > >
> > > > I want to be able to run my tests against each of the items in a way
> > > that I
> > > > can provide the ids to the tests.
> > > >
> > > > Let me know if I can provide more info.
> > > >
> > > > On Tue, Feb 23, 2016 at 5:53 PM, Rodrigo Ramos <
> > > rodrigo.ramos.go@gmail.com
> > > > >
> > > > wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > Is the ID a server response? may be you have to rewrite the URL
> > instead
> > > > of
> > > > > predict the value.
> > > > >
> > > > >
> > > > >
> > > > > 2016-02-23 16:45 GMT-06:00 Meenakshi Sharma <meenakshi8@gmail.com
> >:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I am trying to create load tests. The url looks like this:
> > > > > > http://test.com/items/1/data
> > > > > >
> > > > > > I want to dynamically create item id (1,2,3..) so that it creates
> > new
> > > > > path
> > > > > > by changing item id.
> > > > > >
> > > > > > I tried using CSV Data Set config and added 'id' as variable.
> > > > > > Also added 'id' as parameter in HTTP request which is wrong as it
> > is
> > > > > > leading to following path:
> > > > > > http://test.com/items/{id}/data?id={id}
> > > > > >
> > > > > > Could someone point out what should I try.
> > > > > >
> > > > > > Thanks,
> > > > > > Meena
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: Dynamic Path

Posted by Deepak Shetty <sh...@gmail.com>.
The problem you are seeing is you are asking jmeter to use the value of a
variable named key ${key} - but JMeter cannot find a variable with that
name (And so it just sends ${key}
The question is where is this variable being defined? - And as before put
in a debug sampler + view results tree listener so that you can see whether
or not the variable is  getting set
(You also do not seem to be doping a POST if you are showing parameters in
the URL)

On Wed, Feb 24, 2016 at 9:04 AM, Meenakshi Sharma <me...@gmail.com>
wrote:

> Hi
>
> Thank you Deepak and Rodrigo!
> I was able to fix the path from your suggestion.
>
> I am now able to do a GET from http://test.com/items/${id}/data
> <http://test.com/items/%7Bid%7D/data?id=%7Bid%7D>
> but not POST using http://test.com/items/${id}/data?value=2&key=${key}
> <http://test.com/items/%7Bid%7D/data?id=%7Bid%7D>
>
> The variable ${key} is not being evaluated and I am getting invalid uri
> error.
> Any ideas?
>
> Thanks!
>
> On Tue, Feb 23, 2016 at 6:16 PM, Rodrigo Ramos <rodrigo.ramos.go@gmail.com
> >
> wrote:
>
> > As says Deepak, in JMeter the variables are referenced like in Unix.
> Form:
> >  ${VARIABLE}.
> >
> > 2016-02-23 16:58 GMT-06:00 Meenakshi Sharma <me...@gmail.com>:
> >
> > > hi
> > >
> > > The id is not server response. It refers to different items
> > > For example, shopping list can have several items with different ids.
> > >
> > > I want to be able to run my tests against each of the items in a way
> > that I
> > > can provide the ids to the tests.
> > >
> > > Let me know if I can provide more info.
> > >
> > > On Tue, Feb 23, 2016 at 5:53 PM, Rodrigo Ramos <
> > rodrigo.ramos.go@gmail.com
> > > >
> > > wrote:
> > >
> > > > Hi
> > > >
> > > > Is the ID a server response? may be you have to rewrite the URL
> instead
> > > of
> > > > predict the value.
> > > >
> > > >
> > > >
> > > > 2016-02-23 16:45 GMT-06:00 Meenakshi Sharma <me...@gmail.com>:
> > > >
> > > > > Hi,
> > > > >
> > > > > I am trying to create load tests. The url looks like this:
> > > > > http://test.com/items/1/data
> > > > >
> > > > > I want to dynamically create item id (1,2,3..) so that it creates
> new
> > > > path
> > > > > by changing item id.
> > > > >
> > > > > I tried using CSV Data Set config and added 'id' as variable.
> > > > > Also added 'id' as parameter in HTTP request which is wrong as it
> is
> > > > > leading to following path:
> > > > > http://test.com/items/{id}/data?id={id}
> > > > >
> > > > > Could someone point out what should I try.
> > > > >
> > > > > Thanks,
> > > > > Meena
> > > > >
> > > >
> > >
> >
>

Re: Dynamic Path

Posted by Meenakshi Sharma <me...@gmail.com>.
Hi

Thank you Deepak and Rodrigo!
I was able to fix the path from your suggestion.

I am now able to do a GET from http://test.com/items/${id}/data
<http://test.com/items/%7Bid%7D/data?id=%7Bid%7D>
but not POST using http://test.com/items/${id}/data?value=2&key=${key}
<http://test.com/items/%7Bid%7D/data?id=%7Bid%7D>

The variable ${key} is not being evaluated and I am getting invalid uri
error.
Any ideas?

Thanks!

On Tue, Feb 23, 2016 at 6:16 PM, Rodrigo Ramos <ro...@gmail.com>
wrote:

> As says Deepak, in JMeter the variables are referenced like in Unix. Form:
>  ${VARIABLE}.
>
> 2016-02-23 16:58 GMT-06:00 Meenakshi Sharma <me...@gmail.com>:
>
> > hi
> >
> > The id is not server response. It refers to different items
> > For example, shopping list can have several items with different ids.
> >
> > I want to be able to run my tests against each of the items in a way
> that I
> > can provide the ids to the tests.
> >
> > Let me know if I can provide more info.
> >
> > On Tue, Feb 23, 2016 at 5:53 PM, Rodrigo Ramos <
> rodrigo.ramos.go@gmail.com
> > >
> > wrote:
> >
> > > Hi
> > >
> > > Is the ID a server response? may be you have to rewrite the URL instead
> > of
> > > predict the value.
> > >
> > >
> > >
> > > 2016-02-23 16:45 GMT-06:00 Meenakshi Sharma <me...@gmail.com>:
> > >
> > > > Hi,
> > > >
> > > > I am trying to create load tests. The url looks like this:
> > > > http://test.com/items/1/data
> > > >
> > > > I want to dynamically create item id (1,2,3..) so that it creates new
> > > path
> > > > by changing item id.
> > > >
> > > > I tried using CSV Data Set config and added 'id' as variable.
> > > > Also added 'id' as parameter in HTTP request which is wrong as it is
> > > > leading to following path:
> > > > http://test.com/items/{id}/data?id={id}
> > > >
> > > > Could someone point out what should I try.
> > > >
> > > > Thanks,
> > > > Meena
> > > >
> > >
> >
>

Re: Dynamic Path

Posted by Rodrigo Ramos <ro...@gmail.com>.
As says Deepak, in JMeter the variables are referenced like in Unix. Form:
 ${VARIABLE}.

2016-02-23 16:58 GMT-06:00 Meenakshi Sharma <me...@gmail.com>:

> hi
>
> The id is not server response. It refers to different items
> For example, shopping list can have several items with different ids.
>
> I want to be able to run my tests against each of the items in a way that I
> can provide the ids to the tests.
>
> Let me know if I can provide more info.
>
> On Tue, Feb 23, 2016 at 5:53 PM, Rodrigo Ramos <rodrigo.ramos.go@gmail.com
> >
> wrote:
>
> > Hi
> >
> > Is the ID a server response? may be you have to rewrite the URL instead
> of
> > predict the value.
> >
> >
> >
> > 2016-02-23 16:45 GMT-06:00 Meenakshi Sharma <me...@gmail.com>:
> >
> > > Hi,
> > >
> > > I am trying to create load tests. The url looks like this:
> > > http://test.com/items/1/data
> > >
> > > I want to dynamically create item id (1,2,3..) so that it creates new
> > path
> > > by changing item id.
> > >
> > > I tried using CSV Data Set config and added 'id' as variable.
> > > Also added 'id' as parameter in HTTP request which is wrong as it is
> > > leading to following path:
> > > http://test.com/items/{id}/data?id={id}
> > >
> > > Could someone point out what should I try.
> > >
> > > Thanks,
> > > Meena
> > >
> >
>

Re: Dynamic Path

Posted by Meenakshi Sharma <me...@gmail.com>.
hi

The id is not server response. It refers to different items
For example, shopping list can have several items with different ids.

I want to be able to run my tests against each of the items in a way that I
can provide the ids to the tests.

Let me know if I can provide more info.

On Tue, Feb 23, 2016 at 5:53 PM, Rodrigo Ramos <ro...@gmail.com>
wrote:

> Hi
>
> Is the ID a server response? may be you have to rewrite the URL instead of
> predict the value.
>
>
>
> 2016-02-23 16:45 GMT-06:00 Meenakshi Sharma <me...@gmail.com>:
>
> > Hi,
> >
> > I am trying to create load tests. The url looks like this:
> > http://test.com/items/1/data
> >
> > I want to dynamically create item id (1,2,3..) so that it creates new
> path
> > by changing item id.
> >
> > I tried using CSV Data Set config and added 'id' as variable.
> > Also added 'id' as parameter in HTTP request which is wrong as it is
> > leading to following path:
> > http://test.com/items/{id}/data?id={id}
> >
> > Could someone point out what should I try.
> >
> > Thanks,
> > Meena
> >
>

Re: Dynamic Path

Posted by Rodrigo Ramos <ro...@gmail.com>.
Hi

Is the ID a server response? may be you have to rewrite the URL instead of
predict the value.



2016-02-23 16:45 GMT-06:00 Meenakshi Sharma <me...@gmail.com>:

> Hi,
>
> I am trying to create load tests. The url looks like this:
> http://test.com/items/1/data
>
> I want to dynamically create item id (1,2,3..) so that it creates new path
> by changing item id.
>
> I tried using CSV Data Set config and added 'id' as variable.
> Also added 'id' as parameter in HTTP request which is wrong as it is
> leading to following path:
> http://test.com/items/{id}/data?id={id}
>
> Could someone point out what should I try.
>
> Thanks,
> Meena
>