[Tsung] Use of ts_file_server for input data stream
Pentti Kavanagh
pentti.kavanagh at talgentra.com
Tue Nov 14 22:21:08 CET 2006
Hi,
I'm trying out Tsung for the first time and have a query regarding the
use of ts_file_server. I have a csv file from which I'm reading user
and account ids. I would like to use the data from a single row
multiple times within a session. To get round this I have added a
get_current_line() method to ts_file_server, so I now have something
like this in my readcsv function:-
user(Pid) ->
{ok,Line} = ts_file_server:get_next_line(),
[Username, Passwd, Account] = string:tokens(Line,";"),"tbxUser=" ++
Username ++ "&tbxPwd=" ++ Passwd.
currentaccount(Pid) ->
{ok,Line} = ts_file_server:get_current_line(),
[Username, Passwd, Account] = string:tokens(Line,";"),Account.
Within a session I use user(Pid) to get the login details, and then
currentaccount(Pid) for subsequent substitutions in the same session
where I need the account number. This seems to work fine, but could
this be done a better way (ie. using dynamic variables for example)?
My sample csv file:-
user1;password;200003377
user2;password;200003378
user3;password;200003379
If my solution is ok, then maybe it would be worth including
get_current_line() in ts_file_server as a standard feature.
This is a great project, keep up the good work.
Pentti.
More information about the Tsung-users
mailing list