Exit scenario on condition or after 12 repeats

56 views
Skip to first unread message

alitsiya...@lookout.com

unread,
Jun 24, 2016, 2:50:46 PM6/24/16
to Gatling User Group
Hi,

I have a get request which after about 60 seconds (it can take less or more) should return "complete" status. If this didn't happen after 2 min, this means that test is failed. The code below doesn't exit after "final status check":

.asLongAs(_("status").as[String] != "complete"){
   repeat
(12){
     pause
(10)
   
.exec(http("status check")
       
.get("/api/v2/applications/" + _("param").as[String])
       
.header("Content-Type", "application/json")
       
.queryParam("api_key", Settings.api).asJSON
          .check(jsonPath("$.download.status").saveAs("status"))
    )
   
}
   
.exec(http("final status check")
     
.get("/api/v2/applications/" + _("param").as[String])
       
.header("Content-Type", "application/json")
       
.queryParam("api_key", Settings.api).asJSON
        .check(jsonPath("$.download.status").is("complete"))
     
)
     
.exitHereIfFailed
}

If I would simply do retries, this will add "KO" to test summary every 10 seconds. Since status "complete" is expected somewhere between 1 and 2 minutes, I want the scenario to be "fail fast".
Is there a way to modify the code above to exit on fail after 12 retries or earlier if condition "asLongAs" is met.

Thank you!

Stéphane LANDELLE

unread,
Jul 8, 2016, 2:29:26 AM7/8/16
to gat...@googlegroups.com

Stéphane Landelle
GatlingCorp CEO


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages