You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by ellex3m <el...@yahoo.com> on 2011/01/14 04:47:13 UTC

HTTP Sampler - Post Variables same name with multiple values

Hi Everyone,

I need help with posting data using an http sampler.

I recorded the post data using the http proxy server and i found out that
when I select multiple <options> in a <select> tag, the variable is added
twice in post data.

ex.
-----------------
NAME    VALUE

var1      1
var1      2
-----------------

How can i do this dynamically? I can already extract the values using the
RegEx Extractor but I how can i put it twice in post data?

Thanks!
-- 
View this message in context: http://jmeter.512774.n5.nabble.com/HTTP-Sampler-Post-Variables-same-name-with-multiple-values-tp3340805p3340805.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: HTTP Sampler - Post Variables same name with multiple values

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
yes this also works, but you need to know how many results in advance (e.g.
if you had select all the options then it would be tough to do it this way )

regards
deepak

On Mon, Jan 17, 2011 at 1:28 AM, Michel Duijvestijn <du...@gmail.com>wrote:

> I had the same problem, but solved it in a different way:
> First I changed the Template in my RegEx extractor:
> $1$=$2$&$1$=$3$
> where $1$=var1; $2$=value1; $3$=value2
> This returns a complete part of the parameter string:
> var1=value1&var1=value2
> If this value is assigned to JMeter variable ${refName} then you can put
> this variable directly into the http request at Parameter Name.
> What you have to do in that case is uncheck the 'equals' and 'encode'
> checkboxes: in that way the value of the parameter is sent as you created
> it.
>
> PS are you using JMeter for testing QMP by the way?
>
> 2011/1/14 Deepak Shetty <sh...@gmail.com>
>
> > hi
> > use a BeanShell pre processor (remove these values from the sampler);
> > sampler.addArgument("var1","value1");
> > sampler.addArgument("var1","value2");
> >
> > An example which uses the regex extractor and adds values
> >
> http://theworkaholic.blogspot.com/2010/03/dynamic-parameters-in-jmeter.html
> >
> >
> > regards
> > deepak
> >
> > On Thu, Jan 13, 2011 at 7:47 PM, ellex3m <el...@yahoo.com> wrote:
> >
> > >
> > > Hi Everyone,
> > >
> > > I need help with posting data using an http sampler.
> > >
> > > I recorded the post data using the http proxy server and i found out
> that
> > > when I select multiple <options> in a <select> tag, the variable is
> added
> > > twice in post data.
> > >
> > > ex.
> > > -----------------
> > > NAME    VALUE
> > >
> > > var1      1
> > > var1      2
> > > -----------------
> > >
> > > How can i do this dynamically? I can already extract the values using
> the
> > > RegEx Extractor but I how can i put it twice in post data?
> > >
> > > Thanks!
> > > --
> > > View this message in context:
> > >
> >
> http://jmeter.512774.n5.nabble.com/HTTP-Sampler-Post-Variables-same-name-with-multiple-values-tp3340805p3340805.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: HTTP Sampler - Post Variables same name with multiple values

Posted by Michel Duijvestijn <du...@gmail.com>.
I had the same problem, but solved it in a different way:
First I changed the Template in my RegEx extractor:
$1$=$2$&$1$=$3$
where $1$=var1; $2$=value1; $3$=value2
This returns a complete part of the parameter string:
var1=value1&var1=value2
If this value is assigned to JMeter variable ${refName} then you can put
this variable directly into the http request at Parameter Name.
What you have to do in that case is uncheck the 'equals' and 'encode'
checkboxes: in that way the value of the parameter is sent as you created
it.

PS are you using JMeter for testing QMP by the way?

2011/1/14 Deepak Shetty <sh...@gmail.com>

> hi
> use a BeanShell pre processor (remove these values from the sampler);
> sampler.addArgument("var1","value1");
> sampler.addArgument("var1","value2");
>
> An example which uses the regex extractor and adds values
> http://theworkaholic.blogspot.com/2010/03/dynamic-parameters-in-jmeter.html
>
>
> regards
> deepak
>
> On Thu, Jan 13, 2011 at 7:47 PM, ellex3m <el...@yahoo.com> wrote:
>
> >
> > Hi Everyone,
> >
> > I need help with posting data using an http sampler.
> >
> > I recorded the post data using the http proxy server and i found out that
> > when I select multiple <options> in a <select> tag, the variable is added
> > twice in post data.
> >
> > ex.
> > -----------------
> > NAME    VALUE
> >
> > var1      1
> > var1      2
> > -----------------
> >
> > How can i do this dynamically? I can already extract the values using the
> > RegEx Extractor but I how can i put it twice in post data?
> >
> > Thanks!
> > --
> > View this message in context:
> >
> http://jmeter.512774.n5.nabble.com/HTTP-Sampler-Post-Variables-same-name-with-multiple-values-tp3340805p3340805.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: HTTP Sampler - Post Variables same name with multiple values

Posted by ellex3m <el...@yahoo.com>.
Wow its working great!

Thanks Deepak!

Its nice to know that we have such an active community here in JMeter!
-- 
View this message in context: http://jmeter.512774.n5.nabble.com/HTTP-Sampler-Post-Variables-same-name-with-multiple-values-tp3340805p3340848.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: HTTP Sampler - Post Variables same name with multiple values

Posted by Deepak Shetty <sh...@gmail.com>.
hi
use a BeanShell pre processor (remove these values from the sampler);
sampler.addArgument("var1","value1");
sampler.addArgument("var1","value2");

An example which uses the regex extractor and adds values
http://theworkaholic.blogspot.com/2010/03/dynamic-parameters-in-jmeter.html


regards
deepak

On Thu, Jan 13, 2011 at 7:47 PM, ellex3m <el...@yahoo.com> wrote:

>
> Hi Everyone,
>
> I need help with posting data using an http sampler.
>
> I recorded the post data using the http proxy server and i found out that
> when I select multiple <options> in a <select> tag, the variable is added
> twice in post data.
>
> ex.
> -----------------
> NAME    VALUE
>
> var1      1
> var1      2
> -----------------
>
> How can i do this dynamically? I can already extract the values using the
> RegEx Extractor but I how can i put it twice in post data?
>
> Thanks!
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/HTTP-Sampler-Post-Variables-same-name-with-multiple-values-tp3340805p3340805.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
>
>