[Tsung] Reading External File for ts_http
Muhamad Fadli Ishak
fadliishak at gmail.com
Thu Jan 24 08:59:53 CET 2008
Hello,
I'm very new to Tsung and Erlang. I successfully use it for jabber and http
test.
However I'm still confius on how to read from external file for username
and password for authentication.
I used codes from the manual and found few threads on this but still dont
understand much.
What I did was:
1) Put this in option:
<option name="file_server" value="/tmp/userlist.csv"></option>
My Code:
<options>
<option type="ts_http" name="user_agent" value="true">
<user_agent probability="80">
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513
Galeon/1.3.21
</user_agent>
<user_agent probability="20">
Mozilla/5.0 (Windows; U; Windows NT 5.2; fr-FR; rv:1.7.8)
Gecko/20050511 Firefox/1.0.4
</user_agent>
</option>
<option name="file_server" value="/tmp/list/userlist.csv"></option>
</options>
2) In Session:
<request subst="true"><http
url='/dologin.php?random=%%ts_user_server:get_unique_id%%' version='1.1'
contents='*%%readcsv:user%%*&skin=lightblue'
content_type='application/x-www-form-urlencoded'
method='POST'></http></request>
3) readcsv.erl:
-module(readcsv).
-export([user/1]).
user(Pid)->
{ok,Line} = ts_file_server:get_next_line(),
[Username, Passwd] = string:tokens(Line,";"),
"login_id=" ++ Username ++"&login_pwd=" ++ Passwd.
5) The userlist.csv:
test1;password1
test2;password2
test3;password3
4) I followed the instruction to compile with erlang and put readcsv.beam it
into erlang/lib/tsung-1.2.2/ebin
There were no error message in any logs that Tsung provided. How does Tsung
know which file it will read? Defining in <option> will do? Form tsung
status, I can see users are connected but the users dont do anything.
The users should send message to one particular user. Something like this:
<request><http url='/infoblast/home/portal/outgoing.sms.php' version='1.1'
contents='rcpt=userReceive&subject=TsungTest&content=TsungTest&hour=&minute=&ampm=AM&dateschedule=//&send=NOW&draft=0'
content_type='application/x-www-form-urlencoded'
method='POST'></http></request>
The message sent before I change the code in 2). The original code was:
<request subst="true"><http
url='/dologin.php?random=%%ts_user_server:get_unique_id%%' version='1.1'
contents='login_id=test1&login_pwd=password1&skin=lightblue'
content_type='application/x-www-form-urlencoded'
method='POST'></http></request>
Please help, I'm totally lost.
Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.process-one.net/pipermail/tsung-users/attachments/20080124/862524a5/attachment.html
More information about the Tsung-users
mailing list