AsLongAs end scenario ?


On my scenario, I used an AsLongAs method to check whether a condition is valid or not, and then, use a get request. Yet, my get request never happen…

Here is what was on my scenario :
.asLongAs( condition ) (
exec( http(“action”).get( … ) )
.get(" ")

Am I doing it wrong ?

Thanks for your feedback.

You have to be more specific.
Are you sure that your condition become invalid at some point so you exit the loop?
Are you sure your condition is something that gets reevaluated on each iteration and not a static value?

Yes I am sure the condition become invalid at some point. I do exit the loop, the simulation ends well.

Here is my code :

.asLongAs(session => session(“new_status”).as[String] != “done” && session(“new_status”).as[String] != “killed”) (

Thanks again for your feedback.
Maybe there is a better way to do it…

There’s a cleaner way to write the asLongAs condition so you don’t have to perform the request once before the loop:

session => session(“new_status”).asOption[String].map(value => value != “done” && value != “killed”).getOrElse(true))

Then, I have no idea why you don’t get the expected behavior.

I would need you to provide a runnable sample so I can reproduce.