Varying number of POST bodyParts

G’day folks.

I have a need to be able to add a varying number of body parts to a POST.

For any given iteration, the total number of body parts is determined by three data-driven values, representing the three different possible types of content in these body parts. In loose mathematical form, NBP = (a x NT1) + (b x NT2) + (c x NT3), where a = [0,3], b = [0,4], c = [0, 2] .

My problem is a little similar to the one presented in https://stackoverflow.com/questions/36548126/gatling-request-with-random-number-of-body-parts . Unfortunately for me, the suggested solution isn’t viable in my situation, given the number of combinations at play.

Is there a method of achieving what I’m looking for, but which I’m missing? I’m stumped.

Any help greatly appreciated.

Nige
Gatling 2.2.4

Hey,

Thanks for responding, Stéphane.

Apologies for probable poor notation on my part in the description, but the total number of possible combinations (permutations?) is actually 4 x 5 x 3 = 60. It is unlikely that all of these possibilities will appear in an input file, but my Gatling script needs to be able to cater for all of them, in a dynamic manner, because the input file can (and will) change.

Something like the equivalent functionality of doIf / forEach when adding bodyParts. I can dream. :slight_smile:

You can compute all the combinations and pass them to a randomSwitch, or chain them to execute them sequentially.