On Sat, Jul 10, 2010 at 8:27 AM, Eduardo Martins <emmart...@gmail.com>wrote:

> I would like to repeat N times part of a scenario, how can I do it?
>

You might want to take a look at the attached scenario that I used when I
had to test this:
  - register 10 times
  - unregister


> One idea would be variable value adding then testing if equals N but
> afaik this assigns true to another variable and I could not find a way
> to jump to label if a variable is true, only if is set, but "false"
> sets variable too.
>

I'm pretty sure you can use something like this:

 <nop>
   <action>
      <assign assign_to="counter" value="0"/>
  </action>
 </nop>

 <label id="start_of_loop" />

 ... Some operations ...

  <nop>
    <action>
      <add assign_to="counter" value="1"/>
      <test assign_to="flag_limit" variable="counter"
compare="greater_than_equal" value="20"/>
    </action>
  </nop>

  <nop next="finished" test="flag_limit"/>

  <nop next="start_of_loop"/>

  <label id="finished" />

  ... terminating operations....


regards,
takeshi
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="Register 10 times, then unregister and stop">
  <!-- You must supply a file containing data for injection -->
  <!-- field0 : username -->
  <!-- field2 : domain -->
  <!-- field2 : authentication -->  
  <!-- Sample
SEQUENTIAL
gandalf;middle-earth.org;[authentication username=gandalf password=qerafecdsdr]
  -->

  <nop>
    <action>
      <assign assign_to="cseq" value="0" />
      <assignstr assign_to="str_expires" value="3600"/>
    </action>
  </nop>

  <label id="send_register_request" />

  <nop>
    <action>
      <add assign_to="cseq" value="1" />

      <assignstr assign_to="str_cseq" value="[$cseq]" />
      <ereg regexp="[0-9]+" search_in="var" variable="str_cseq" assign_to="str_cseq" check_it="true" />
    </action>
  </nop>

  <send retrans="500">
    <![CDATA[

REGISTER sip:[field1] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
From: "[field0]" <sip:[fiel...@[field1]>;tag=[pid]SIPpTag00[call_number]
To: "[field0]" <sip:[fiel...@[field1]>
Call-ID: [call_id]
Contact: <sip:[fiel...@[local_ip]:[local_port]>
CSeq: [$str_cseq] REGISTER
Max-Forwards: 70
Expires: [$str_expires]
Allow: INVITE,CANCEL,ACK,BYE,NOTIFY,REFER,OPTIONS,INFO,MESSAGE
User-Agent: ATA
Content-Length: 0

    ]]>
  </send>

  <recv response="401" auth="true" next="auth_required" optional="true"/>
  <recv response="407" auth="true" next="auth_required"/>

  <label id="auth_required" />

  <nop>
    <action>
      <add assign_to="cseq" value="1" />

      <assignstr assign_to="str_cseq" value="[$cseq]" />
      <ereg regexp="[0-9]+" search_in="var" variable="str_cseq" assign_to="str_cseq" check_it="true" />
    </action>
  </nop>

  <send retrans="500">
    <![CDATA[

REGISTER sip:[field1] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
From: "[field0]" <sip:[fiel...@[field1]>;tag=[pid]SIPpTag00[call_number]
To: "[field0]" <sip:[fiel...@[field1]>
Call-ID: [call_id]
Contact: <sip:[fiel...@[local_ip]:[local_port]>
CSeq: [$str_cseq] REGISTER
[field2]
Expires: [$str_expires]
User-Agent: ATA
Content-Length: 0

    ]]>
   </send>

  <recv response="200">
  </recv>

  <label id="final_response_received"/>

  <nop next="finished" test="flag_limit"/>

  <nop>
    <action>
      <test assign_to="flag_limit" variable="cseq" compare="greater_than_equal" value="20"/>
    </action>
  </nop>

  <label id="pause"/>
  <!-- This delay is customized by the -d command-line option       -->
  <pause/>

  <nop condexec="flag_limit">
    <action>
      <assignstr assign_to="str_expires" value="0"/>
    </action>
  </nop>

  <nop next="send_register_request"/>

  <label id="finished"/>

  <pause milliseconds="1000" />

  <!-- definition of the response time repartition table (unit is ms)   -->
  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>

  <!-- definition of the call length repartition table (unit is ms)     -->
  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>

</scenario>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to