jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Successive calls to __StringFromFile return the same value
Date Tue, 09 Nov 2010 03:06:00 GMT
On 8 November 2010 20:10, Andrei Ghimus <ghimus@gmail.com> wrote:
> On Mon, Nov 8, 2010 at 9:00 PM, sebb <sebbaz@gmail.com> wrote:
>> On 8 November 2010 19:52, Andrei Ghimus <ghimus@gmail.com> wrote:
>>> Good day!
>>>
>>> I'm calling
>>> word1=${__StringFromFile(query.txt)} word2=${__StringFromFile(query.txt)}
>>> and I expect ${word1} and ${word2} to have different values
>>> (specifically, ${word2} to get the value from the following line).
>>> This does not happen i.e. ${word1} and ${word2} have the same value.
>>
>> What test element have you used them in?
> Java Request sampler.
>>
>>> Any idea why?
>>
>> Subtle bug, because SFF generally works OK.

(it's been a long while since I used the function...just as well it is
documented.)

It's not a bug, this is by design, see:

http://jakarta.apache.org/jmeter/usermanual/functions.html#__StringFromFile

"If there are multiple references to the function in a test script,
each will open the file independently, even if the file names are the
same."

It's intended for passing a single item of information to a sampler.

You could either split the file into two, or join the lines and use
__split to split them.

>>
>>> And if this is not the way to do it, maybe someone could
>>> offer an alternative.
>>
>> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#CSV_Data_Set_Config
> The description for CSV Data Set Config says that lines are only read
> at the start of an iteration. I need to read the next line at each
> call. Can I do that?

No, but you can put the element in a nested loop.

>>
>>> Thanks in advance.
>>>
>>> P.S.: JMeter 2.4

---------------------------------------------------------------------
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