Class IfController

  • All Implemented Interfaces:
    java.io.Serializable , java.lang.Cloneable , org.apache.jmeter.control.Controller , org.apache.jmeter.gui.Searchable , org.apache.jmeter.testelement.TestElement , org.apache.jmeter.testelement.ThreadListener , org.apache.jmeter.threads.TestCompilerHelper

    
    public class IfController
    extends GenericController implements Serializable, ThreadListener
                        

    This is a Conditional Controller; it will execute the set of statements (samplers/controllers, etc) while the 'condition' is true.

    In a programming world - this is equivalent of :

    if (condition) {
             statements ....
             }
    
    In JMeter you may have :
    Thread-Group (set to loop a number of times or indefinitely,
       ... Samplers ... (e.g. Counter )
       ... Other Controllers ....
       ... IfController ( condition set to something like - ${counter} < 10)
          ... statements to perform if condition is true
          ...
       ... Other Controllers /Samplers }
    
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      IfControllerSchema getSchema()
      PropertiesAccessor<out IfController, out IfControllerSchema> getProps() Allows type-safe accessors to the properties of the current element.
      void setCondition(String condition) Condition Accessor - this is gonna be like ${count} < 10
      String getCondition() Condition Accessor - this is gonna be like ${count} < 10
      boolean isDone()
      Sampler next()
      void triggerEndOfLoop()
      boolean isEvaluateAll()
      void setEvaluateAll(boolean b)
      boolean isUseExpression()
      void setUseExpression(boolean selected)
      void threadStarted() Called for each thread before starting sampling.
      void threadFinished() Called for each thread after all samples have been processed.
      • Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

        addTestElement, canRemove, clear, clearTestElementChildren, clone, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse
      • Methods inherited from class org.apache.jmeter.control.GenericController

        addIterationListener, addTestElement, addTestElementOnce, initialize, removeIterationListener, setFirst
      • Methods inherited from class org.apache.jmeter.control.Controller

        addIterationListener
      • Methods inherited from class org.apache.jmeter.testelement.TestElement

        addTestElement, canRemove, clear, clearTestElementChildren, clone, get, get, get, get, get, get, get, get, get, getComment, getName, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getProperty, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyOrNull, getProps, getSchema, getString, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, removed, set, setComment, setEnabled, setName, setProperty, setTemporary, traverse
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IfController

        IfController()
        constructor
      • IfController

        IfController(String condition)
        constructor
        Parameters:
        condition - The condition for this controller
    • Method Detail

      • getProps

         PropertiesAccessor<out IfController, out IfControllerSchema> getProps()

        Allows type-safe accessors to the properties of the current element. Note: when overriding the method, ensure you emit wildcards. For instance: JMeterElementInstance<? extends TestPlanClass> getProps() { return ... }

      • setCondition

         void setCondition(String condition)

        Condition Accessor - this is gonna be like ${count} < 10

        Parameters:
        condition - The condition for this controller
      • getCondition

         String getCondition()

        Condition Accessor - this is gonna be like ${count} < 10

        Returns:

        the condition associated with this controller

      • threadStarted

         void threadStarted()

        Called for each thread before starting sampling. WARNING: this is called before any Config test elements are processed, so any properties they define will not have been merged in yet. See org.apache.jmeter.threads.JMeterThread#threadStarted()

      • threadFinished

         void threadFinished()

        Called for each thread after all samples have been processed. See org.apache.jmeter.threads.JMeterThread#threadFinished(org.apache.jmeter.engine.event.LoopIterationListener)