How to organize collections of Http calls inside scenario

15 Views Asked by At

I want to have collection of http calls inside same scenario. here is my code:

        var scenario = Scenario.Create("Create_assets_with_data", async context =>
            {
                await Step.Run("Create_asset", context, async () =>
                {
                    for (int i = 0; i < 20; i++)
                    {
                        var request =
                            Http.CreateRequest("Post", $"/api/import/assets")
                                .WithHeader("Authorization", AuthorizationHeader)
                                .WithBody(Body);

                        var response = await Http.Send(httpClient, request);
                    }
                    return Response.Ok();
                });

                return Response.Ok();
            })
            .WithInit(Init);

The problem with this code - it has no actually correct statistics (RPS, Failed requests count etc)

Other option - is to have step for each of http call - but I don't like this idea - since logically its same step.

I would greatly appreciate any ideas.

0

There are 0 best solutions below