jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Dynamic naming of files in HTTP Request
Date Thu, 20 Jan 2011 18:31:09 GMT
On 20 January 2011 16:27, Dan Heitbohmer <dan@conceptual.ca> wrote:
> Hi Sebb,
>
> Thanks for the fast response.
>
> I inserted a 3000 ms timer after the login JSON data gets read to be sure it
> is set.
>
> From the Debug Sampler placed directly before the HTTP Request, in the tree
> view it outputs the variables as set:
>
> JMeterVariables:
> JMeterThread.last_sample_ok=true
> JMeterThread.pack=org.apache.jmeter.threads.SamplePackage@1153ad1
> START.HMS=012016
> START.MS=1295504416996
> START.YMD=20110120
> TESTSTART.MS=1295539900817
> __test_user=dummyuser1@dummy.com
> test_user=dummyuser1@dummy.com

So only references to

${__test_user}   and   ${test_user} will resolve.

>
> The file string is in the HTTP Request node in the "Send Files With the
> Request" input box. Variables in the "Send Parameters With the Request"
> (POST) do get set.
> Is it possible that the variable only gets set at start of the thread in
> this case?

Depends where the variable is set, but even so, it should still be
picked up by the HTTP sampler.

There was a bug relating to this:
https://issues.apache.org/bugzilla/show_bug.cgi?id=46901
but that was fixed in 2.4

To try and track this down:

Try setting the variable on the Test Plan itself.

When this is working, you can try setting the variable later in the test plan.

> If so, I can probably set up the files sequenced by a counter, the email in
> the file string would just make tracing a bit easier.
>
> Thanks in advance,
>
> Dan
>
>
>
> On 1/20/2011 10:34 AM, sebb wrote:
>>
>> On 20 January 2011 15:26, Dan Heitbohmer<dan@conceptual.ca>  wrote:
>>>
>>> Hi,
>>>
>>> This is my first attempt at using JMeter and I have searched for the
>>> answer
>>> to this for a long while now and I am stuck. Sorry if this is a newbie
>>> question.
>>>
>>> I am using JMeter 2.4 r961953 GUI on windows 7 to simulate a FLEX
>>> application interacting with a LAMP server. The login dictates what data
>>> needs to be simulated via unique AMF requests.
>>>
>>> I have used Zend AMF to decode the recorded responses and re-encoded them
>>> to
>>> created a set of files with the test user email encoded in the filename
>>> for
>>> each AMF response per user.
>>> ie.
>>>
>>> C:\Users\heikie\Downloads\jakarta-jmeter-2.4\bin\dummyuser1@dummy.com_POST5923361474048999554.binary
>>>
>>> I have created an auto login script in PHP that returns a JSON response
>>> that
>>> i can use the variables in JMeter to send data via POST so I am certain
>>> that
>>> my regular expression is pulling the correct data.
>>>
>>> So, all that I think I need to do is get the replacer working for the
>>> filename string, i tried these:
>>>
>>>
>>> C:\Users\heikie\Downloads\jakarta-jmeter-2.4\bin\${test_user}_POST5923361474048999554.binary
>>>
>>> C:\Users\heikie\Downloads\jakarta-jmeter-2.4\bin\'${'test_user'}'_POST5923361474048999554.binary
>>>
>>> C:\Users\heikie\Downloads\jakarta-jmeter-2.4\bin\${__test_user}_POST5923361474048999554.binary
>>>
>>> C:\Users\heikie\Downloads\jakarta-jmeter-2.4\bin\'${'__test_user'}'_POST5923361474048999554.binary
>>>
>>> The output from the View Results Tree shows something like this:
>>> java.io.FileNotFoundException:
>>>
>>> C:\Users\heikie\Downloads\jakarta-jmeter-2.4\bin\'${'test_user'}'_POST3771789563464406421.binary
>>
>> See:
>>
>> http://jakarta.apache.org/jmeter/usermanual/functions.html#functions
>>
>> "If an undefined function or variable is referenced, JMeter does not
>> report/log an error - the reference is returned unchanged. For example
>> if UNDEF is not defined as a variable, then the value of ${UNDEF} is
>> ${UNDEF}."
>>
>> So either you are not setting the variable at all, or the variable is
>> set after it is needed by the test element.
>>
>> Add a Debug Sampler to show what variables you have created.
>>
>>> (The system cannot find the file specified)
>>>    at java.io.FileInputStream.open(Native Method)
>>>    at java.io.FileInputStream.<init>(Unknown Source)
>>>    at java.io.FileInputStream.<init>(Unknown Source)
>>>    at
>>>
>>> org.apache.jmeter.protocol.http.sampler.PostWriter.writeFileToStream(PostWriter.java:406)
>>>    at
>>>
>>> org.apache.jmeter.protocol.http.sampler.PostWriter.sendPostData(PostWriter.java:143)
>>>    at
>>>
>>> org.apache.jmeter.protocol.http.sampler.HTTPSampler.sendPostData(HTTPSampler.java:122)
>>>    at
>>>
>>> org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:508)
>>>    at
>>>
>>> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:965)
>>>    at
>>>
>>> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:951)
>>>    at
>>>
>>> org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:348)
>>>    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)
>>>    at java.lang.Thread.run(Unknown Source)
>>>
>>> Should the string show the path with the replaced values or the
>>> variables?
>>>
>>> Any advice would be appreciated.
>>>
>>> Thanks,
>>>
>>> Dan
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
>
> --
> Dan Heitbohmer
> Conceptual Pathways Inc.
> 519.273.3377
> dan@conceptual.ca
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message