GithubHelp home page GithubHelp logo

Comments (6)

tisba avatar tisba commented on June 29, 2024

As far as I can tell, the value is currently not substituted.

However it's a bit hard to fully understand your problem. Could you please surround your XML configuration using ``` (code blocks)? And I'd appreachiate it if you could format your XML a little bit to make it easier to read :)

from tsung.

alicehanhy avatar alicehanhy commented on June 29, 2024

Ok,thank you.

<options>
 <option name="file_server" id="userdb" value="/usr/local/tsung6/hanhy/login/case1/enc.csv"></option> 
</options>

<sessions> 
<session probability="100" name="raw" type="ts_raw"> 
<setdynvars sourcetype="file" fileid="userdb" delimiter="," order="iter"> 
 <var name="userid"/> 
 <var name="username"/>
</setdynvars>
<transaction name="data">
 <request subst="true"> 
  <dyn_variable name="loginTag" re="&lt;success xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;&gt;(.*)@im.ebnew.com/Tsung&lt;/success&gt;"/>
  <raw data="&lt;auth xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot; resource=&quot;Tsung&quot;&gt;%%_username%%&lt;/auth&gt;" ack="local"></raw> 
 </request> 
</transaction>
<thinktime value="4"/>
<transaction name="close">
 <if var="loginTag" eq="userid">
 <request> 
  <raw data="stopstopstop" ack="local"></raw> 
 </request> 
 </if> 
</transaction> 
</session> 
</sessions> 

from tsung.

bltb avatar bltb commented on June 29, 2024

I think the DSL does not (yet) support dynamic variable expansion in the control flow blocks such as if.

If you really need this now, you could try...

<setdynvars sourcetype="eval"
            code="fun({Pid,DynVars})->
                      {ok,Val1}=ts_dynvars:lookup(loginTag,DynVars),
                      {ok,Val2}=ts_dynvars:lookup(userid,DynVars),
                       Val1 =:= Val2 end.">
  <var name="is_expected_userid" />
</setdynvars>

<transaction name="close">
 <if var="is_expected_userid" eq="true">
 <request>
  <raw data="stopstopstop" ack="local"></raw>
 </request>
 </if>
</transaction>

from tsung.

bltb avatar bltb commented on June 29, 2024

Could we close this?
Or maybe tag this as an enhancement?
@alicehanhy, by the way, did the "workaround" work for you?

from tsung.

alicehanhy avatar alicehanhy commented on June 29, 2024

Ok

from tsung.

tisba avatar tisba commented on June 29, 2024

IMO the value part of <if> should support substitution.

Adding this should be fairly simple. Code to take a look at is this:

ctrl_struct_impl({if_start,Rel, VarName, Value, Target},DynVars) ->
case ts_dynvars:lookup(VarName,DynVars) of
{ok,VarValue} ->
?DebugF("If found ~p; value is ~p~n",[VarName,VarValue]),
?DebugF("Calling need_jump with args ~p ~p ~p~n",[Rel,Value,VarValue]),
Jump = need_jump('if',rel(Rel,Value,VarValue)),
jump_if(Jump,Target,DynVars);
false ->
ts_mon_cache:add({ count, 'error_if_undef'}),
{next,DynVars}
end;

Value needs to be processed via ts_search:subst. This way it may contain placeholders like foo-%%_userid%%.

from tsung.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.