[Tsung] setdynvars problem

Matteo mcanato at gmail.com
Tue May 27 08:42:16 CEST 2008


Hi list,

i'm working on my own plugin with the setdynvars variables with the snv
tsung trunk rev 851. I want to read from a .csv file a set of user/passwd
and create a request with these parameters. In the trunk i see that this is
possible (http_setdynvars.xml) and i write tried to "copy" the code in my
own plugin. But i think i'm wrong somewhere in the code, because in the
request, tsung doesn't substitute the dynvar value...

Example:

%%%% mytest.xml
    <options>
        <option name="file_server" id='userdb'
value="/home/matteo/Desktop/BACKUP/23-maggio/mwg.csv"/>
    </options>
<-cut->
            <setdynvars sourcetype="file" fileid="userdb" delimiter=";"
order="iter">
                <var name="user" />
                <var name="passwd" />
            </setdynvars>
<-cut->
            <request subst="true">
                <mytest type="send" user="%%_user%%"
password="%%_passwd%%"></mytest>
            </request>

%%%%%% ts_config_mytest.erl
<-cut->
    Request = case ts_config:getAttr(atom, Element#xmlElement.attributes,
type) of
                  login ->
            #ts_request{ack = no_ack, endpage = true, dynvar_specs = DynVar,
subst = SubstFlag, match = MatchRegExp,
                    param = #mytest_request{type=login}};
                  send ->
            User = ts_config:getAttr( Element#xmlElement.attributes, user),
            Password = ts_config:getAttr( Element#xmlElement.attributes,
password),
            #ts_request{ack = parse, endpage = true, dynvar_specs = DynVar,
subst = SubstFlag, match = MatchRegExp,
                    param = #plcdtester_request{type=send, user=User,
password=Password}};


%%%%%%%% Results in the log
=INFO REPORT==== 26-May-2008::22:09:31 ===
       ts_mytest:(5:<0.76.0>) ts_mytest:parse(<<"OK 01 3bf94f8a\r\n">>,
#state_rcv{acc=[], dyndata={dyndata,

[{user,

"00000001"},

{passwd,

"12345678"}],

{mytest_dyndata,

undefined}}})

=INFO REPORT==== 26-May-2008::22:09:31 ===
    "SERIAL VALUE: %%_user%%" - [ts_mytest,
                                                           5,
                                                           <0.76.0>|
                                                           ts_mytest]


In fact, the my client send the string "%%_user%%" to the server instead of
the string "00000001". The field {mytest_dyndata, undefined} is used for
other use in my app and it run perfectly.

Where i'm wrong?

Best regards,
M.Canato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.process-one.net/pipermail/tsung-users/attachments/20080527/5991f063/attachment.html


More information about the Tsung-users mailing list