You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Heiko Robert <he...@ecm4u.de> on 2010/01/12 22:47:05 UTC
sampler variable contains BSF Preprocessor output from previous call
Hello,
I want to create a unique ID using a BSF PreProcessor script and use
that for the http requests to be able to map every request on the
backend. My script works fine but the sampler variable contains the
output from the previous sampler request!
My testplan
tread group 1
BSF PreProcessor
id=...
vars.put('GUID', id)
HTTP Header Manager
X-GUID = ${GUID}
loop controler
HTTP Request 1
HTTP Request 2
Simple Data Writer csv
test.csv
Simple Data Writer xml
test.xml
jmeter.properties
sample_variables=GUID
When executing the script, the HTTP request header variable ${GUID}
contains the variable from the previous request but the output of
sample_variables=GUID in the logfile lists the actual value. The very
first request has an empty value. Is there something I have to take into
account when setting variables in a BSF ProProcessor script? It looks
like that the variable in the HTTP Header Manager is populated _before
executing the BSF Preprocessor...
Does anybody have an idea how to get the correct values in the request?
The simplyfied XML output from the Simple Data Writer looks like
<httpSample GUID="2c3b75c3-d057-47fd-af42-109408513d5c">
<requestHeader class="java.lang.String">X-GUID: ${GUID}</requestHeader>
</httpSample>
<httpSample GUID="edb03730-e890-4185-8cbb-622abfb42ff9">
<requestHeader class="java.lang.String">X-GUID:
2c3b75c3-d057-47fd-af42-109408513d5c</requestHeader>
</httpSample>
Maybe this is related to this bug?
http://www.mailinglistarchive.com/jmeter-dev@jakarta.apache.org/msg12579.html
Thanks
Heiko
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: sampler variable contains BSF Preprocessor output from previous
call
Posted by Heiko Robert <he...@ecm4u.de>.
issue is solved.
The problem was that I used variables in the HTTP Header Manager and
Header Manager is a Configuration element, which is processed before the
thread starts. The work around is to use functions in the config-Element
instead of variables.
Details are described in thread:
"HTTP Header Manager uses old variable values?"
http://mail-archives.apache.org/mod_mbox/jakarta-jmeter-user/201001.mbox/%3C4B4DBFC8.3030002@ecm4u.de%3E
Heiko
Heiko Robert schrieb:
> Hi jmeter gurus,
>
> to brake my issue down:
> when using sample_variables (e.g. GUID) in jmeter.properties to log
> variable values the logged value is not identical to the value used in
> the sampler or with other words the sampler uses variable values from
> the _previous sample:
>
> log entry 01 GUID = value01
> sample request GUID = NULL
>
> log entry02 GUID = value02
> sample request GUID = value01
>
> The PreProcessor behaves like a PostProcessor. The variables are
> populated _after sample
>
> Has anybody an idea how to fix that?
>
> thanks a lot in advance
>
> Heiko
>
> Heiko wrote:
>> Hello,
>> I want to create a unique ID using a BSF PreProcessor script and use
>> that for the http requests to be able to map every request on the
>> backend. My script works fine but the sampler variable contains the
>> output from the previous sampler request!
>>
>> My testplan
>> tread group 1
>> BSF PreProcessor
>> id=...
>> vars.put('GUID', id)
>> HTTP Header Manager
>> X-GUID = ${GUID}
>> loop controler
>> HTTP Request 1
>> HTTP Request 2
>> Simple Data Writer csv
>> test.csv
>> Simple Data Writer xml
>> test.xml
>>
>> jmeter.properties sample_variables=GUID
>> When executing the script, the HTTP request header variable
>> ${GUID} contains the variable from the previous request but the
>> output of sample_variables=GUID in the logfile lists the actual
>> value. The very first request has an empty value. Is there something
>> I have to take into account when setting variables in a BSF
>> ProProcessor script? It looks like that the variable in the HTTP
>> Header Manager is populated _before executing the BSF Preprocessor...
>>
>> Does anybody have an idea how to get the correct values in the request?
>>
>> The simplyfied XML output from the Simple Data Writer looks like
>> <httpSample GUID="2c3b75c3-d057-47fd-af42-109408513d5c">
>> <requestHeader class="java.lang.String">X-GUID:
>> ${GUID}</requestHeader>
>> </httpSample>
>> <httpSample GUID="edb03730-e890-4185-8cbb-622abfb42ff9">
>> <requestHeader class="java.lang.String">X-GUID:
>> 2c3b75c3-d057-47fd-af42-109408513d5c</requestHeader>
>> </httpSample>
>>
>> Maybe this is related to this bug?
>> http://www.mailinglistarchive.com/jmeter-dev@jakarta.apache.org/msg12579.html
>>
>>
>> Thanks
>> Heiko
>>
>> ---------------------------------------------------------------------
>> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: sampler variable contains BSF Preprocessor output from previous
call
Posted by Heiko Robert <he...@ecm4u.de>.
Hi jmeter gurus,
to brake my issue down:
when using sample_variables (e.g. GUID) in jmeter.properties to log
variable values the logged value is not identical to the value used in
the sampler or with other words the sampler uses variable values from
the _previous sample:
log entry 01 GUID = value01
sample request GUID = NULL
log entry02 GUID = value02
sample request GUID = value01
The PreProcessor behaves like a PostProcessor. The variables are
populated _after sample
Has anybody an idea how to fix that?
thanks a lot in advance
Heiko
Heiko wrote:
> Hello,
> I want to create a unique ID using a BSF PreProcessor script and use
> that for the http requests to be able to map every request on the
> backend. My script works fine but the sampler variable contains the
> output from the previous sampler request!
>
> My testplan
> tread group 1
> BSF PreProcessor
> id=...
> vars.put('GUID', id)
> HTTP Header Manager
> X-GUID = ${GUID}
> loop controler
> HTTP Request 1
> HTTP Request 2
> Simple Data Writer csv
> test.csv
> Simple Data Writer xml
> test.xml
>
> jmeter.properties sample_variables=GUID
> When executing the script, the HTTP request header variable
> ${GUID} contains the variable from the previous request but the output
> of sample_variables=GUID in the logfile lists the actual value. The
> very first request has an empty value. Is there something I have to
> take into account when setting variables in a BSF ProProcessor script?
> It looks like that the variable in the HTTP Header Manager is
> populated _before executing the BSF Preprocessor...
>
> Does anybody have an idea how to get the correct values in the request?
>
> The simplyfied XML output from the Simple Data Writer looks like
> <httpSample GUID="2c3b75c3-d057-47fd-af42-109408513d5c">
> <requestHeader class="java.lang.String">X-GUID:
> ${GUID}</requestHeader>
> </httpSample>
> <httpSample GUID="edb03730-e890-4185-8cbb-622abfb42ff9">
> <requestHeader class="java.lang.String">X-GUID:
> 2c3b75c3-d057-47fd-af42-109408513d5c</requestHeader>
> </httpSample>
>
> Maybe this is related to this bug?
> http://www.mailinglistarchive.com/jmeter-dev@jakarta.apache.org/msg12579.html
>
>
> Thanks
> Heiko
>
> ---------------------------------------------------------------------
> 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