scenariobuilder and actionbuilder -- creating scenarios dynamically/programmatically from a file

Hello Group,

Gatling and scala newbie here, done plenty of searching and looked at the documentation, but i need a gentle nudge to get me going:

I’d have a file (a formatted wiremock journal) that i’d like to use to create a gating scenario on the fly. The file several lines like this:

{ “when”: “21:21:09”, “url”: “/ssows/SSOws”, “in”: “<soap:Envelope xmlns:soap=“”>soap:Body<ns5:getToken xmlns:ns2=“java:language_builtins.lang” xmlns:ns3=“” xmlns:ns4=“” xmlns:ns5=“”>ns3:passwordxy</ns3:password>ns3:uidapp_cengage_sso</ns3:uid></ns5:getToken></soap:Body></soap:Envelope>”, “out”: “<soap:Envelope xmlns:soap=“”>soap:Body<ns5:getTokenResponse xmlns:ns2=“” xmlns:ns3=“java:language_builtins.lang” xmlns:ns4=“” xmlns:ns5=“”>ns2:branchDesignator0</ns2:branchDesignator>…ns2:uidapp_cengage_sso</ns2:uid></ns5:getTokenResponse></soap:Body></soap:Envelope>” }

From this is I have all the elements to create, line per line ( a counter would increment for each line in a loop ),

.exec( http(“step 0 = getToken(app_cengage_sso,xy)”).post("/ssows/SSOws").body(StringBody("""<soap:Envelope xmlns… /soap:Envelope>""")).check(xpath("//ns4:token", List(“ns4” → “”)).saveAs(“admintoken0”)).check(xpath("//ns2:uid", List(“ns2” → “java:java:language_builtins.lang”)).saveAs(“uid0”)) )

I know I would be instatiating a scenariobuilder and an actionbuilder to do this work, but both are abstract classes and I cannot work with them the way I am used to in java (scala is new to me). Can any one point me the way? Merci.


I have noticed someone trying to do something similar in a foreach loop. Is this the better approach? How to have the outer loop read from a text file?

val scn = scenario(“Test”)

.exec(session => {
foreach(xs, “x”) {

val x = session(“x”).as[Integer]