Reputation: 175
I am trying to execute a doWhile but I am getting this compilation error:
missing argument list for method doWhile in trait Loops Unapplied methods are only converted to functions when a function type is expected. You can make this conversion explicit by writing
doWhile _
ordoWhile(_,_)(_)
instead ofdoWhile
.
This is my code:
builder
.doWhile("${scrollId.exists()}") {
exec(http(s"$title")
.post(endpoint)
.headers(headers)
.body(ElFileBody(requestBodyFilePath))
.check(jsonPath("$.scrollId").saveAs("scrollId"))
.check(status.is(200)))
.pause(1)
//save value from response
.exec(session => {
.doIf(session("scrollId").asOption[String].isEmpty)
val scrollId = session("scrollId").asOption[String].get
session.set("scrollId", scrollId)
})
}
}
Thank you!
Upvotes: 2
Views: 1469
Reputation: 6623
The correct syntax for doWhile
is doWhile(condition) { chain }
, eg:
builder
.doWhile("${scrollId.exists()}") {
exec(http(s"$title")
.post(endpoint)
.headers(headers)
.body(ElFileBody(requestBodyFilePath))
.check(jsonPath("$.scrollId").saveAs("scrollId"))
.check(status.is(200)))
.pause(1)
//save value from response
.exec(session => {
val scrollId = session("scrollId").asOption[String].get
session.set("scrollId", scrollId)
})
}
Upvotes: 3