Re: sampler variable contains BSF Preprocessor output from previous call
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.3030...@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.StringX-GUID: ${GUID}/requestHeader /httpSample httpSample GUID=edb03730-e890-4185-8cbb-622abfb42ff9 requestHeader class=java.lang.StringX-GUID: 2c3b75c3-d057-47fd-af42-109408513d5c/requestHeader /httpSample Maybe this is related to this bug? http://www.mailinglistarchive.com/jmeter-...@jakarta.apache.org/msg12579.html Thanks Heiko - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: HTTP Header Manager uses old variable values?
Hi sebb, of course the CSV Dataset Config element is the swiss army knife for jmeter users ;-) but for these use cases I don't like it because I have to make sure that I never use keys twice to be able to map the logs later to the backend logs. Very cool would be a REST Dataset Config element or a JDBC Dataset Config element to delegate logic execution and to handle unique keys in a central service. I should experience more with the Bean Shell component to find a way to get this done. Thanks a lot anyway for your excellent and promt support Heiko - Ursprüngliche Mail - Von: sebb seb...@gmail.com An: JMeter Users List jmeter-user@jakarta.apache.org Gesendet: Mittwoch, 13. Januar 2010 17:44:44 GMT +01:00 Amsterdam/Berlin/Bern/Rom/Stockholm/Wien Betreff: Re: HTTP Header Manager uses old variable values? On 13/01/2010, Heiko Robert heiko.rob...@ecm4u.de wrote: sebb, thanks a lot - that works !!! ;-) For everybody who tries to populate a GUID into a HTTP-Header variable here is the full solution: define a user variable: MyGUIDScript = var chars = '0123456789abcdef'.split(''); var uuid = [], rnd = Math.random, r; uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'; uuid[14] = '4'; for (var i = 0; i 36; i++) { if (!uuid[i]) {r = 0 | rnd()*16; uuid[i] = chars[(i == 19) ? (r 0x3) | 0x8 : r 0xf]; } }; uuid.join(''); In the HTTP Header Manager: X-GUID = ${__javaScript(${MyGUIDScript},GUID)} Since the code does not rely on any input from the server, you could use similar code to write the GUIDs to a file, and use the CSV Dataset Config element to read them. sebb schrieb: On 13/01/2010, Heiko Robert heiko.rob...@ecm4u.de wrote: Hi, when I use HTTP Header Manager to set HTTP header variables old values are used. Has anybody an idea what I'm doing wrong? Header Manager is a Configuration element, and is processed before the thread starts. You can use functions on the Test Plan to define variables. My Testplan: user defined variables: GUID = not set BSF PreProcessor: setting values to variable GUID Simple Controller HTTP Request ${GUID} HTTP Header Manager: setting X-GUID = ${GUID} HTTP Request ${GUID} HTTP Header Manager: setting X-GUID = ${GUID} View Results Tree The results: HTTP Request 472c63c2-63d5-44c4-a717-9252e2a7f8bf GET http://www.apache.org/?X-GUID=472c63c2-63d5-44c4-a717-9252e2a7f8bf Request Headers: X-GUID: not set HTTP Request 472c63c2-63d5-44c4-a717-9252e2a7f8bf GET http://www.apache.org/?X-GUID=e6df3a7d-e054-444b-9ef8-7c9c2803821e Request Headers: X-GUID: 472c63c2-63d5-44c4-a717-9252e2a7f8bf I tried with latest jmeter versions and also with the nightly build Thanks Heiko - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: sampler variable contains BSF Preprocessor output from previous call
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.StringX-GUID: ${GUID}/requestHeader /httpSample httpSample GUID=edb03730-e890-4185-8cbb-622abfb42ff9 requestHeader class=java.lang.StringX-GUID: 2c3b75c3-d057-47fd-af42-109408513d5c/requestHeader /httpSample Maybe this is related to this bug? http://www.mailinglistarchive.com/jmeter-...@jakarta.apache.org/msg12579.html Thanks Heiko - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
HTTP Header Manager uses old variable values?
Hi, when I use HTTP Header Manager to set HTTP header variables old values are used. Has anybody an idea what I'm doing wrong? My Testplan: user defined variables: GUID = not set BSF PreProcessor: setting values to variable GUID Simple Controller HTTP Request ${GUID} HTTP Header Manager: setting X-GUID = ${GUID} HTTP Request ${GUID} HTTP Header Manager: setting X-GUID = ${GUID} View Results Tree The results: HTTP Request 472c63c2-63d5-44c4-a717-9252e2a7f8bf GET http://www.apache.org/?X-GUID=472c63c2-63d5-44c4-a717-9252e2a7f8bf Request Headers: X-GUID: not set HTTP Request 472c63c2-63d5-44c4-a717-9252e2a7f8bf GET http://www.apache.org/?X-GUID=e6df3a7d-e054-444b-9ef8-7c9c2803821e Request Headers: X-GUID: 472c63c2-63d5-44c4-a717-9252e2a7f8bf I tried with latest jmeter versions and also with the nightly build Thanks Heiko - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: HTTP Header Manager uses old variable values?
sebb, thanks a lot - that works !!! ;-) For everybody who tries to populate a GUID into a HTTP-Header variable here is the full solution: define a user variable: MyGUIDScript = var chars = '0123456789abcdef'.split(''); var uuid = [], rnd = Math.random, r; uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'; uuid[14] = '4'; for (var i = 0; i 36; i++) { if (!uuid[i]) {r = 0 | rnd()*16; uuid[i] = chars[(i == 19) ? (r 0x3) | 0x8 : r 0xf]; } }; uuid.join(''); In the HTTP Header Manager: X-GUID = ${__javaScript(${MyGUIDScript},GUID)} sebb schrieb: On 13/01/2010, Heiko Robert heiko.rob...@ecm4u.de wrote: Hi, when I use HTTP Header Manager to set HTTP header variables old values are used. Has anybody an idea what I'm doing wrong? Header Manager is a Configuration element, and is processed before the thread starts. You can use functions on the Test Plan to define variables. My Testplan: user defined variables: GUID = not set BSF PreProcessor: setting values to variable GUID Simple Controller HTTP Request ${GUID} HTTP Header Manager: setting X-GUID = ${GUID} HTTP Request ${GUID} HTTP Header Manager: setting X-GUID = ${GUID} View Results Tree The results: HTTP Request 472c63c2-63d5-44c4-a717-9252e2a7f8bf GET http://www.apache.org/?X-GUID=472c63c2-63d5-44c4-a717-9252e2a7f8bf Request Headers: X-GUID: not set HTTP Request 472c63c2-63d5-44c4-a717-9252e2a7f8bf GET http://www.apache.org/?X-GUID=e6df3a7d-e054-444b-9ef8-7c9c2803821e Request Headers: X-GUID: 472c63c2-63d5-44c4-a717-9252e2a7f8bf I tried with latest jmeter versions and also with the nightly build Thanks Heiko - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
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.StringX-GUID: ${GUID}/requestHeader /httpSample httpSample GUID=edb03730-e890-4185-8cbb-622abfb42ff9 requestHeader class=java.lang.StringX-GUID: 2c3b75c3-d057-47fd-af42-109408513d5c/requestHeader /httpSample Maybe this is related to this bug? http://www.mailinglistarchive.com/jmeter-...@jakarta.apache.org/msg12579.html Thanks Heiko - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org