Reputation: 131
I would like to have the ability to pass in checks to a method that makes a gatling post. I am having some issue doing so. I tried using a few different types on the checks but had no luck. I would like to have something like the below on a "page" object that would be used elsewhere in the app. I think I briefly saw there are other types of checks beyond status based checks. I would like the method to be flexible enough to handle such things if possible.
protected val commonChecks = Seq(status.not(404),status.not(503))
def login(checks:HttpCheck = commonChecks) = {
exec(http("post login")
.post("/login")
.headers(someheader)
.formParam("login", "${userName}")
.formParam("password", "${password}")
.check(commonChecks) //.check(commonChecks: _*) don't work
)
}
Upvotes: 1
Views: 784
Reputation: 2851
What if you explicit the type of commonChecks
:
protected val commonChecks: Seq[HttpCheck] = Seq(status.not(404),status.not(503))
def login(checks:HttpCheck = commonChecks) = {
exec(http("post login")
.post("/login")
.headers(someheader)
.formParam("login", "${userName}")
.formParam("password", "${password}")
.check(commonChecks: _*)
)
IntelliJ
seems to infer the following type otherwise:
Seq[CheckBuilder[HttpCheck, Response, Response, Int] with SaveAs[HttpCheck, Response, Response, Int]]
which causes the compilation error.
Upvotes: 2