You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Vinicius Carvalho <vi...@auge.com.br> on 2004/09/17 18:16:10 UTC

Using Functions

Hi there. I'm trying to use a function _StringFromFile(); in my test 
plan, but it's not working as expected, I missunderstood something ...

In a HTTP Sampler I'm using 
${_StringFromFile(c:\temp\news.txt,fnNews,,,)} as a parameter value. But 
instead of the first line of the file be written in the request, the 
string '${_StringFromFile(c:\temp\news.txt,fnNews,,,)}' is writtend instead.

What's wrong with usage?

Thanx

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


Re: Using Functions

Posted by sebb <se...@gmail.com>.
Check jmeter.log for errors.

I've just run a test, and it looks like you need to remove the
trailing ",,," - StringFromFile does not like empty optional
parameters (I think I've fixed that post 2.0.1)

==

You don't need the ",fnNews" unless you want to reuse the value later.

If reusing function values in multiple samplers, you may find it
easier to add a User Parameters Pre-Processor to set up all the
variables, and then reference them using the variable name.

BTW, you only need to create one user on the User Parameters page. 
All threads will use the same value *definition* - the value itself
will vary if the function output varies. e.g. you could use

THRD  ${__threadNum()}

Subsequent references to ${THRD}  would return the number for that thread.

S.

S.
On Fri, 17 Sep 2004 13:16:10 -0300, Vinicius Carvalho
<vi...@auge.com.br> wrote:
> Hi there. I'm trying to use a function _StringFromFile(); in my test
> plan, but it's not working as expected, I missunderstood something ...
> 
> In a HTTP Sampler I'm using
> ${_StringFromFile(c:\temp\news.txt,fnNews,,,)} as a parameter value. But
> instead of the first line of the file be written in the request, the
> string '${_StringFromFile(c:\temp\news.txt,fnNews,,,)}' is writtend instead.
> 
> What's wrong with usage?
> 
> Thanx
> 
> ---------------------------------------------------------------------
> 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: Using Functions

Posted by Michael Stover <ms...@apache.org>.
instead of ${_StringFromFile(c:\temp\news.txt,fnNews,,,)}
try ${_StringFromFile(c:\\temp\\news.txt,fnNews,,,)}

-Mike

On Fri, 2004-09-17 at 12:16, Vinicius Carvalho wrote:
> Hi there. I'm trying to use a function _StringFromFile(); in my test 
> plan, but it's not working as expected, I missunderstood something ...
> 
> In a HTTP Sampler I'm using
>  as a parameter value. But 
> instead of the first line of the file be written in the request, the 
> string '${_StringFromFile(c:\temp\news.txt,fnNews,,,)}' is writtend instead.
> 
> What's wrong with usage?
> 
> Thanx
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
-- 
Michael Stover <ms...@apache.org>
Apache Software Foundation


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