You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by je...@bnf.fr on 2005/02/01 18:04:28 UTC

R �f. : Re: reading file in a While Controller

Hello,

Finally I found a solution, I replaced the "User defined variables" element
by "User defined parameter" where I can defined any function, and which is
executed each time if the check box "Update once per iteration" is checked


Thanks for your help
Jérôme

User Defined variable
       webcca = ${_StringFromFile(${fichierWebCca},requeteUtilisateur,,)}

 loop (2)
     User Parameter: (check box "Update once per iteration" checked
         ${_StringFromFile(${requeteUtilisateur},ligneCourante,,)}
         ${__logn(LECTURE  ligne courante de ${requeteUtilisateur}:
 ${ligneCourante}:   ,,)}
         http request (  ${ligneCourante}  )
 Assert Results

 The file pointed by ${requeteUtilisateur} contains
 url1
 url2


Date: Wed, 26 Jan 2005 00:39:03 +0000
From: Sebb <se...@gmail.com>
Subject: R�f. : Re: reading file in a While Controller
Content-Type: text/plain; charset=US-ASCII


The following test plan works for me:

Thread Group (forever)
 - User Parameters (Pre-Processor), with:
     * update once per iteration
     * Name=V, User_1=${_StringFromFile(sff.txt,,,1)}
 - Request that uses ${V}
 - Table Listener.

sff.txt contains a few lines of text - the sampler will be run once
for each line in the file.

In fact, you don't need the While Controller for this - StringFromFile
will stop the thread if it runs out of files to process. In this case
the count is 1, so it will stop processing at the end of the file.

Try it and see.

S.
On Fri, 21 Jan 2005 14:38:56 +0100, jerome.dupont@bnf.fr
<je...@bnf.fr> wrote:
> Hi, and Thanks for your answer:
>
> I tried with a loop, and it still doesn't work, so I logged the user
param
> section, to understand what happens exactly.
>
> User Defined variable
>       webcca = ${_StringFromFile(${fichierWebCca},requeteUtilisateur,,)}
>
> loop (2)
>     User Defined Variable:
>         ${_StringFromFile(${requeteUtilisateur},ligneCourante,,)}
>         ${__logn(LECTURE  ligne courante de ${requeteUtilisateur}:
> ${ligneCourante}:   ,,)}
>         http request (  ${ligneCourante}  )
> Assert Results
>
> The file pointed by ${requeteUtilisateur} contains
> url1
> url2
>
> In the assertion result pane, I can see that the httprequest is sent
twice,
> but with url1 parameter each time.
> In the log file, I can see the message correspondig to "__logn(LECTURE
> ligne courante de ${requeteUtilisateur}: ${ligneCourante}:" only once.
>
> It's like , the http request is executed 2 times while the User Defined
> Variable once.
>
> I tried with several value for StringToFile last parameter (no value, 1
and
> 2), but it behave the same, reading the first line of the file.
>
> Regards,
>       Jerome