title: Invoking Transaction controller or HTTP sampler from Bean shell/JSR223
body: <p><strong>Problem statement.</strong>
  Set of transactions(1000+) and need to call or reuse(without duplicating in different if/switch controllers) by invoking from the Beanshell or JSR233.</p>
  
  <p>In SoapUI we have groovy script option to break sequential execution and divert control to any  request using the below command.</p>
  
  <pre><code>if( Math.random() &gt; 0.5 )
     testRunner.runTestStepByName( "Request 1")
  else
     testRunner.runTestStepByName( "Request 2")
  
  // do something else
  ....
  </code></pre>
  
  <p>Same functionality available in Loadrunner(Run time setting with different action) and neoload too. </p>
  
  <p><strong>Do we have any built-in objects or function to execute by transaction or Sampler name from JSR223/BeanShell without using if/while/switch controller</strong> ?</p>
  
  <p>For Example:</p>
  
  <p>In script 10 transactions are there and to use same script for different scenario by setting a JMeter property during execution through Jenkins or command prompt .</p>
  
  <pre><code>__P(Flow,RoomBooking)
  </code></pre>
  
  <p>Then from JSR233 /beanshell sampler</p>
  
  <pre><code>if(Flow=="RoomBooking"){
  
  invoke Login 
  
  invoke BookRoom
  
  invoke Logout
  
  } else if(Flow=="RoomBookingNBookItinerary")
  
  invoke Login 
  
  invoke BookRoom
  
  invoke BookItinerary
  
  invoke Logout
  
  }else if(Flow=="RoomBookingNcancel")
  
  invoke Login 
  
  invoke BookRoom
  
  Invoke ParkTicket 
  
  invoke CancelRoom
  
  invoke Logout
  
  }Like different flows with different thread and throughput 
  </code></pre>
  
  <p>In this case I can mix and match different flows and and reuse same script for different flow. 
  This would help to reduce script rework effort during application changes.  </p>