How to have the test end, based on run-time conditions

Using v2.1.7

The way I understand it, the only way to set when the test end (or what is the duration of the test) is to set the maxDuration on the SetUp object in the Simulation.
I need to be able to set the length of the test based on conditions that are determined at run-time. How can that be done?

Thanks in advance.

Regards,
Ori

bump…

You need to choose between controlling your session through the injection model, which is very limited, or control it in the logic of the flow, which is more capable from a logic standpoint, but has some tradeoffs.

Check out asLongAs: http://gatling.io/docs/2.1.7/general/scenario.html?highlight=aslongas#loop-statements