Hi, I would like to know if there is a proper way to make a custom check on the request status ( like is / not / …)
atm,I want to check non-regression of an API and check as good if the older 500/400 status are still here or if it have disappear, i also want to consider every 200 status as good.
I’m also using a feeder to build my query and replay log.
I would like do to something “ideally” like this :
... .check(status.is("${status}") || !status.in(400 to 510)) ...
Is there any solution to my problem ?
Use “in” and pass a function that would take the session as input, fetch the “status” attribute and return a Seq[Int] with the (100 to 510) range complete with this value.
I’m ok with you but I don’t understant how to get the session value,
today i got something like this
`
I’m ok with you but I don’t understant how to get the session value,
today i got something like this
`
Got any idea on my previous post ?
var mysession :Session = _
What's this global reference doing here???
var scn = scenario("test")
.feed(feeder)
.doIf(session =>
{mysession = session
session("method").as[String].equals("GET")}){
http://gatling.io/docs/2.2.1/general/scenario.html#doifequals
exec(http("request_GET")
.get("${url}")
.check(status.in(getGoodHttpStatus(mysession))))
}
...
def getGoodHttpStatus(session : Session): Seq[Int] ={
val list = new ListBuffer[Int]()
list ++= 200 to 230
list += session("status").as[Int]
list.toList
}
// like you did, assuming "status" is indeed an Int and not a String that
could be parsed into an Int
status.is(session => session("status").validate[Int]).map(status => (200 to
300).toSet + status))
But it look's horrible !
I concur
Thank’s but I tryied your solution and it give me an error :
expected HttpCheck, actual Validation[Int],
I don’t understand how to get over it. Have you any idea ?
Use a status.in() check, but pass a function instead of a value, where you would resolve the “status” attribute value and concatenate with the (400 to 510) range.