jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dongsheng Song <dongsheng.s...@gmail.com>
Subject Re: Is there have any variables can be used within functions that generate different results each time they are called ?
Date Sun, 02 Dec 2012 08:14:58 GMT
Hi,

When I use 'User Parameters', I still got oddly results from JMeter 2.8:

User Parameters
    remainTime = -1
    loopNumber = -1

HTTP POST TO PAGE01
    BeanShell PreProcessor ...
    Regex PostProcessor: get errorCode
    BeanShell PostProcessor
        vars.put("remainTime", "123");
        vars.put("loopNumber", "456");

While Controller (${__javaScript(${loopNumber} > 0 &&
"${errorCode_g1}" == "0")} )
    BeanShell Timer
         vars.get("loopNumber") still got loopNumber = -1 !!!
    HTTP POST TO PAGE02
        Regex PostProcessor: get errorCode

BeanShell Timer
     vars.get("remainTime") still got remainTime = -1 !!!
HTTP POST TO PAGE03

Thanks,
Dongsheng


On Sun, Dec 2, 2012 at 4:07 AM, sebb <sebbaz@gmail.com> wrote:
> On 1 December 2012 12:45, Dongsheng Song <dongsheng.song@gmail.com> wrote:
>> Hi all,
>>
>> I want to execute the following test plan:
>>
>> HTTP POST SAMPLER - PAGE01
>>   -- GOT SLEEP TIME ST, LOOP TIMES LT (got different values every sampler)
>>   LOOP LT TIMES
>>     SLEEP ST
>>     HTTP POST - PAGE02
>>       --GOT ERROR CODE
>>     IF ERROR CODE != 0
>>       BREAK LOOP
>>
>> But the test behavior looks unexpected, then I found 'UDVs should not
>> be used with functions that generate different results each time they
>> are called'.
>>
>> http://jmeter.apache.org/usermanual/component_reference.html#User_Defined_Variables
>
> Use
>
> http://jmeter.apache.org/usermanual/component_reference.html#User_Parameters
>
> instead, as that is invoked before each sample in scope.
>
>> Thanks,
>> Dongsheng
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>

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


Mime
View raw message