You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by amelaao <am...@gmail.com> on 2006/05/17 16:26:52 UTC

params and variables

My Thread consists of several SOAP/XML-RPC samplers.Samplers are similar
regarding the input variables, but assertions are very different so it
doesn't make sense to use CSV file as input. I need to set several variables
for each sampler and the each variable needs to be local for the sampler. I
used pre-processor user parameters to set the values but it seems not to be
working fine. If I hardcode the values in the request itself I have no
problems. With user defined params I don't get the consistent behaviour.
What would be the best option? Variables can also be global, but how do I
change the value for each sampler before it is run?
-- 
Regards,
Amela

Re: params and variables

Posted by sebb <se...@gmail.com>.
On 17/05/06, amelaao <am...@gmail.com> wrote:
> On 5/17/06, sebb <se...@gmail.com> wrote:
>
> > On 17/05/06, amelaao <am...@gmail.com> wrote:
> > > My Thread consists of several SOAP/XML-RPC samplers.Samplers are similar
> > > regarding the input variables, but assertions are very different so it
> >
> > Do you mean response assertions?
>
>
> One one of them I may use one Xpath assertions, on the other I may use
> different Xpath assertions. Similarly, on some of them I may have different
> Response assertions. In essence these are different test cases for testing
> same Web Service.
>
>
>
> > > doesn't make sense to use CSV file as input.
> >
> > Why not?
> >
> > > I need to set several variables
> > > for each sampler and the each variable needs to be local for the
> > sampler. I
> >
> > Seems like a suitable case for CSV Data Set
> >
> > > used pre-processor user parameters to set the values but it seems not to
> > be
> > > working fine.
> >
> > What is not working?
> >
> > > If I hardcode the values in the request itself I have no
> > > problems. With user defined params I don't get the consistent behaviour.
> >
> > What behaviour do you get?
> >
> > > What would be the best option? Variables can also be global, but how do
> > I
> > > change the value for each sampler before it is run?
> >
> > I'm not really sure what you are trying to do, so it is difficult to
> > advise...
>
>
> I want to pass a variable or a parameter to each sampler, where the variable
> names are the same, but the values are not. I was thinking that having
> pre-processor for each sampler where I have user param and I assign it a
> different value will take care of this.
>
> Thread1:
>     -Sampler 1
>         - pre-processor
>             - User Parameters
>                 param: name_a   value_1
>                            name_b ......
>             - XPath assertion 1
>      -Sampler 2
>         - pre-processor
>             - User Parameters
>                 param: name_a   value_2
>                            name_c ........
>            - Response Assertion 1
>            - Xpath assertion 2
>
>
> Another reason why I'm trying to avoid CSV I'm part of a large group and we
> are trying to minimize dependencies on external files as much as possible,
> since our code is shared. Also, my test scripts are going to be executed by
> manual testers and automated scripts, and manual testers and developers
> prefer to change the values of variables if they need inside the testcase
> itself (inside JMeter).
>  My question is I guess, besides CSV, is this a way to set params to a
> Sampler, or should I use Config Element (User Defined Variables).

I'm assuming that you don't need to set lots of different variables,
otherwise you would need an external file.

In this case, the easiest is probably to set them all on the Test Plan.

You can even add comments to say how to fill in the values.

For use with automated scripts, it is easiest to use properties -
defined on the command-line or in a properties file.

If you define the following on the Test Plan:

D_USER         bill
D_ID               123

these can be used later as defaults for the __P() function on a UDV
Config Element:

USER             ${__P(prop.user,${D_USER})}
ID                   ${__P(prop.id,${D_ID})}

and then you use ${USER} and ${ID} in the test plan.

If the properties prop.user and prop.id are not defined, then USER and
ID default to the values on the TestPlan, otherwise they pick up the
values from the properties.

You can do this all on the Test Plan, but it's harder to edit - the
test plan would look like:

USER             ${__P(prop.user,bill)}

i.e. the tester would need to change _part_ of the value.

The tedious bit is setting up the UDV, but it only has to be done once.

Try it and see with a few examples to see how it works out.

S.

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


Re: params and variables

Posted by amelaao <am...@gmail.com>.
On 5/17/06, sebb <se...@gmail.com> wrote:

> On 17/05/06, amelaao <am...@gmail.com> wrote:
> > My Thread consists of several SOAP/XML-RPC samplers.Samplers are similar
> > regarding the input variables, but assertions are very different so it
>
> Do you mean response assertions?


One one of them I may use one Xpath assertions, on the other I may use
different Xpath assertions. Similarly, on some of them I may have different
Response assertions. In essence these are different test cases for testing
same Web Service.



> > doesn't make sense to use CSV file as input.
>
> Why not?
>
> > I need to set several variables
> > for each sampler and the each variable needs to be local for the
> sampler. I
>
> Seems like a suitable case for CSV Data Set
>
> > used pre-processor user parameters to set the values but it seems not to
> be
> > working fine.
>
> What is not working?
>
> > If I hardcode the values in the request itself I have no
> > problems. With user defined params I don't get the consistent behaviour.
>
> What behaviour do you get?
>
> > What would be the best option? Variables can also be global, but how do
> I
> > change the value for each sampler before it is run?
>
> I'm not really sure what you are trying to do, so it is difficult to
> advise...


I want to pass a variable or a parameter to each sampler, where the variable
names are the same, but the values are not. I was thinking that having
pre-processor for each sampler where I have user param and I assign it a
different value will take care of this.

Thread1:
    -Sampler 1
        - pre-processor
            - User Parameters
                param: name_a   value_1
                           name_b ......
            - XPath assertion 1
     -Sampler 2
        - pre-processor
            - User Parameters
                param: name_a   value_2
                           name_c ........
           - Response Assertion 1
           - Xpath assertion 2


Another reason why I'm trying to avoid CSV I'm part of a large group and we
are trying to minimize dependencies on external files as much as possible,
since our code is shared. Also, my test scripts are going to be executed by
manual testers and automated scripts, and manual testers and developers
prefer to change the values of variables if they need inside the testcase
itself (inside JMeter).
 My question is I guess, besides CSV, is this a way to set params to a
Sampler, or should I use Config Element (User Defined Variables).

Thanks.

Re: params and variables

Posted by sebb <se...@gmail.com>.
On 17/05/06, amelaao <am...@gmail.com> wrote:
> My Thread consists of several SOAP/XML-RPC samplers.Samplers are similar
> regarding the input variables, but assertions are very different so it

Do you mean response assertions?

> doesn't make sense to use CSV file as input.

Why not?

> I need to set several variables
> for each sampler and the each variable needs to be local for the sampler. I

Seems like a suitable case for CSV Data Set

> used pre-processor user parameters to set the values but it seems not to be
> working fine.

What is not working?

> If I hardcode the values in the request itself I have no
> problems. With user defined params I don't get the consistent behaviour.

What behaviour do you get?

> What would be the best option? Variables can also be global, but how do I
> change the value for each sampler before it is run?

I'm not really sure what you are trying to do, so it is difficult to advise...

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