Hi,
I have the following scenario where I want to measure the performance of a http service. I have eventually to perform a login http request if a cookie is not present in the session, and then I call the http service. My issue is that the doIf always returns false.
def loginRequest: HttpRequestBuilder = {
val url = “http://server:port/users/access”
http(“post_login_users”)
.post(url)
.header(“Cache-Control”, “no-cache”)
.header(“Content-Type”, “application/json”)
.basicAuth("${email}", “${password}”)
.check(status.find.in(200, 204))
}
def serviceRequest: HttpRequestBuilder = {
val url = “http://server:port/service”
http(“post_login_users”)
.post(url)
.header(“Cache-Control”, “no-cache”)
.header(“Content-Type”, “application/json”)
.check(status.find.in(200, 204))
}
val scn = scenario(“myscenario”).feed(csv(“csvPath”).circular).during(duration) {
.doIf(!_.contains(“cookieName”)) {
exec(loginRequestFunc)
}
.exec {
session => println(session.contains(secCookieName))
session
}
.exec(serviceRequest)
}
Also, I’d like to know what’s the best approach to measure the performance of the service request without being biased by the login request latencies? Is it possible to perform previously the login in the before {} block and store the “email, password, cookie” in another CSV, and then inject the cookies?
What’s the best approach?
Thanks in advance.
Sofiane