You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by CharekC <ch...@gmail.com> on 2007/05/23 22:41:17 UTC

Extracting form nvps for http request parameters

I am reading up on html link parser but need some clarification.
How can I do the following?

I have n http requests for adding to cart using a loop. 
>From the last add to cart response, there is a html form for the next link:
ordercheckout
The ordercheckout is a http post with a variable amount of params.
Eg http://myhost/ordercheckout?orderid=123&orderitem_1=..&orderitem_2=..

How can I setup the parms for the ordercheckout such that it has all the
name value pairs from the last add to cart? html link parser can fill in
values but you have supply all the names. In my scenario, there's a variable
amount of nvps. Is there some kind of form extractor which nvps can
automatically be placed into the params for a http request?
-- 
View this message in context: http://www.nabble.com/Extracting-form-nvps-for-http-request-parameters-tf3806439.html#a10772367
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: Extracting form nvps for http request parameters

Posted by sebb <se...@gmail.com>.
On 24/05/07, CharekC <ch...@gmail.com> wrote:
>
> Ok, thanks sebb-2. I think this is doable
>
> 1. Use regex pp to get the <form ... /form> section as a string
>
> 2. Use something to parse string for nvps (name="xxx" value="yyy") and build
> a string in the format xxx=yyy&...

Yes, given that the original data is not in the correct format, and
you don't know the number of items in advance.

> 3. Put that string as req parameter in next http request
>
> Just wondering what I should use for 2. Beanshell? Javascript?

Whichever you are happier with. I would use BeanShell, because I know
Java better than Javascript, but either would do.

If you use BeanShell, you can use the init file to define a method to
do the transformation, and then the function call will be simpler.
Javascript functions don't currently support init files, so all the
code will need to be in the function call.

>
> sebb-2 wrote:
> >
> > As you say, the Link Parser only replaces parameters that are already
> > on the form.
> >
> > You could try using the Regex Post-Processor to extract the orderid
> > value and all the parameters after it using an RE like:
> >
> > orderid=(.+)
> >
> > and then use it on the form, but deselect "encode parameter", so when
> > the sampler adds the value for orderid, it will also add the rest of
> > the string.
> >
> > Not sure if it will work, but worth a try.
> >
> >
> > On 23/05/07, CharekC <ch...@gmail.com> wrote:
> >>
> >> I am reading up on html link parser but need some clarification.
> >> How can I do the following?
> >>
> >> I have n http requests for adding to cart using a loop.
> >> From the last add to cart response, there is a html form for the next
> >> link:
> >> ordercheckout
> >> The ordercheckout is a http post with a variable amount of params.
> >> Eg http://myhost/ordercheckout?orderid=123&orderitem_1=..&orderitem_2=..
> >>
> >> How can I setup the parms for the ordercheckout such that it has all the
> >> name value pairs from the last add to cart? html link parser can fill in
> >> values but you have supply all the names. In my scenario, there's a
> >> variable
> >> amount of nvps. Is there some kind of form extractor which nvps can
> >> automatically be placed into the params for a http request?
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Extracting-form-nvps-for-http-request-parameters-tf3806439.html#a10772367
> >> 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
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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://www.nabble.com/Extracting-form-nvps-for-http-request-parameters-tf3806439.html#a10786210
> 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
>
>

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


Re: Extracting form nvps for http request parameters

Posted by CharekC <ch...@gmail.com>.
Ok, thanks sebb-2. I think this is doable

1. Use regex pp to get the <form ... /form> section as a string
2. Use something to parse string for nvps (name="xxx" value="yyy") and build
a string in the format xxx=yyy&...
3. Put that string as req parameter in next http request

Just wondering what I should use for 2. Beanshell? Javascript? 


sebb-2 wrote:
> 
> As you say, the Link Parser only replaces parameters that are already
> on the form.
> 
> You could try using the Regex Post-Processor to extract the orderid
> value and all the parameters after it using an RE like:
> 
> orderid=(.+)
> 
> and then use it on the form, but deselect "encode parameter", so when
> the sampler adds the value for orderid, it will also add the rest of
> the string.
> 
> Not sure if it will work, but worth a try.
> 
> 
> On 23/05/07, CharekC <ch...@gmail.com> wrote:
>>
>> I am reading up on html link parser but need some clarification.
>> How can I do the following?
>>
>> I have n http requests for adding to cart using a loop.
>> From the last add to cart response, there is a html form for the next
>> link:
>> ordercheckout
>> The ordercheckout is a http post with a variable amount of params.
>> Eg http://myhost/ordercheckout?orderid=123&orderitem_1=..&orderitem_2=..
>>
>> How can I setup the parms for the ordercheckout such that it has all the
>> name value pairs from the last add to cart? html link parser can fill in
>> values but you have supply all the names. In my scenario, there's a
>> variable
>> amount of nvps. Is there some kind of form extractor which nvps can
>> automatically be placed into the params for a http request?
>> --
>> View this message in context:
>> http://www.nabble.com/Extracting-form-nvps-for-http-request-parameters-tf3806439.html#a10772367
>> 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
>>
>>
> 
> ---------------------------------------------------------------------
> 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://www.nabble.com/Extracting-form-nvps-for-http-request-parameters-tf3806439.html#a10786210
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: Extracting form nvps for http request parameters

Posted by sebb <se...@gmail.com>.
As you say, the Link Parser only replaces parameters that are already
on the form.

You could try using the Regex Post-Processor to extract the orderid
value and all the parameters after it using an RE like:

orderid=(.+)

and then use it on the form, but deselect "encode parameter", so when
the sampler adds the value for orderid, it will also add the rest of
the string.

Not sure if it will work, but worth a try.


On 23/05/07, CharekC <ch...@gmail.com> wrote:
>
> I am reading up on html link parser but need some clarification.
> How can I do the following?
>
> I have n http requests for adding to cart using a loop.
> From the last add to cart response, there is a html form for the next link:
> ordercheckout
> The ordercheckout is a http post with a variable amount of params.
> Eg http://myhost/ordercheckout?orderid=123&orderitem_1=..&orderitem_2=..
>
> How can I setup the parms for the ordercheckout such that it has all the
> name value pairs from the last add to cart? html link parser can fill in
> values but you have supply all the names. In my scenario, there's a variable
> amount of nvps. Is there some kind of form extractor which nvps can
> automatically be placed into the params for a http request?
> --
> View this message in context: http://www.nabble.com/Extracting-form-nvps-for-http-request-parameters-tf3806439.html#a10772367
> 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
>
>

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