Article Figure 1 Figure 2 Figure 3 Figure 4
Listing 1 Listing 2 Listing 3 Listing 4 jun2006.tar

Listing 4 An example of how to iterate through a series of values calling a given task

<project name="example4" default="complexJmeter" >
<property file="default.properties"/>

    <!-- Add two new task sets -->
    <taskdef resource="net/sf/antcontrib/antlib.xml">
      <classpath>
        <pathelement location="../extlib/ant-contrib.jar" />
      </classpath>
    </taskdef>    
    <taskdef
    name="jmeter"
    classpath="../extlib/ant-jmeter.jar"
    classname="org.programmerplanet.ant.taskdefs.jmeter. \
      JMeterTask"/>

<!-- Clean results directory -->
<target name="init" >
    <delete dir="${jmeter.dir}/results" />
    <mkdir dir="${jmeter.dir}/results" />
</target>

<!-- loop through threads and call task, setting a property -->
<target name="complexJmeter" depends="init"  \
  description="Complex example of a Jmeter test" >
    <for list="${example.four.threads}" param="threads">
     <sequential>  
           <echo>
               Testing for Threads @{threads}
           </echo>
         
        <ant antfile="example3b.xml" target="JmeterTest"  \
          inheritall="true" >
            <property name="all.threads" value="@{threads}"/>
        </ant>
     </sequential>
    </for>        
</target>
</project>