How to use a loop to chain exec

Using a StringBuilder I can write the following:

        StringBuilder bu = new StringBuilder();


        for (int i = 0; i < 3; i++) {
			bu.append(i + "");

How can I do the same with

ScenarioBuilder scn = scenario("RecordedSimulation").exec(...).exec(...).exec(...));

thanks for your help.

What is the use case?
What do you want to achieve?

Hi @Maurus,

The main difference is that StringBuilder is mutable, while ScenarioBuilder is not.

Try to think how you achieve the same thing with String instead of StringBuilder.


Hi Gerard,

the use case is:
I have an ArrayList of HttpRequestActionBuilder with a variable size and therefore I would like write the senario in a loop. In the loop the HttpRequestActionBuilder sould be added to the scenario like

ScenarioBuilder scn;
ArrayList<HttpRequestActionBuilder> hRBuilders = new ArrayList<>();

for(HttpRequestActionBuilder b : hRBuilders){
        //is not possible       

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.