HttpCheck in gatling 3.0 for post

Hi,

I was trying to migrate to 3.0 version but I have problem with http status check,.
Most likely I’m missing something but I don’t understand what changed in 3.0

I had this code

  def reportScenario(duration:DurationInt,exitAsap:Boolean=false)  = {

    during(duration.seconds, "counter", exitAsap) {
      exec(
        http("GetCost by Month ProductName")
          .post("v2/aggregate")
          .body(
            StringBody(BodyStringsAws.reportsOverViewByProduct(
               Constants.startDate, Constants.endDate,
              s"""  "Tenant":["${Tenants.Flex} "]""",
              """ "operation","tenant" """
            ))).asJSON
          .check(status.is(400))
      ).pause(Constants.pauseDuration)
 }
}
}

In 2.3 this check was working but in version 3.0 I have error

found : io.gatling.core.check.CheckBuilder[io.gatling.http.check.status.HttpStatusCheckType,io.gatling.http.response.Response,Int]
with io.gatling.core.check.SaveAs[io.gatling.http.check.status.HttpStatusCheckType,io.gatling.http.response.Response,Int]
[error] required: io.gatling.http.check.HttpCheck
[error] .check(status.is(400))

For get request it’s seems that it’s OK.

Any suggestions ?

Lukasz

My2cents: you’ve re-organized imports, which is a very bad idea.
If that’s the case, please stick to the expected wildcard imports as they are defined everywhere in the doc:

import io.gatling.core.Predef._
import io.gatling.http.Predef._

Thanks, my bad I was importing only http and statu and not using wildcards, probably it was generated by intelij and I didn’t touch it.

Could you please explain bit more what you mean by re-organize import ?

Regards
Lukasz

It’s named optimize imports in IntelliJ and organize imports in Eclipse: https://www.jetbrains.com/help/idea/creating-and-optimizing-imports.html

thanks, that also bit me.
Problem is that you get a “type mismatch error” instead of the correct error similar to Java “class not found” with an option to import it in IntelliJ.
Any chance this could be improved? I’ve even got the Scala plugin installed.