jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: How to set Variables in JMeter
Date Wed, 03 Sep 2014 15:44:02 GMT
Hi
Case #1
define a variable which has two values 1 or 2 (e.g. using
http://jmeter.apache.org/usermanual/functions.html#__Random) and then
lookup the String value  (i.e if 1 then online , else offline).
Case #2 same as above - you have 6 possible ids so vary a random number
between 1 and 6 and then lookup the value you want

Since the examples you have given have such few variations (2 and 6) what
I'd probably do is define for case #1 is define two variables (should
actually be properties)
device_status_1 = online
device_status_2 = offline
and use ${__V(device_status_${__Random(1,2)})} wherever I want
online/offline

You can do the same for Case 2 --
http://jmeter.apache.org/usermanual/functions.html#__V


regards
deepak





On Wed, Sep 3, 2014 at 7:27 AM, 张为东(为东) <weidong.zwd@alibaba-inc.com> wrote:

> Hi experts,
>
>
>
> I have some questions on Variables setting when I am in some scenarios
> during testing. Do you have any good suggestion on it?
>
>
>
> Case #1:
>
> In “User Defined Variables”, I add one Variable named **device_status**,
> the value should be set as online or offline, how to set in configuration
> item “value”?
>
> When I run JMeter, the variable “device_status” can be set as “online” or
> “offline” randomly.
>
>
>
> Case #2:
>
> In “User Defined Variables” as well, I add one Variable named **id**, the
> value should be in special number below, how to set in configuration item
> “value”?
>
> When I run JMeter, the variable “id” can be set in one of the group
> “2|5|6|12|15|22” randomly.
>
>
>
> Thanks
>
> --Weidong
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message