Hi everyone, I would like to compare simple string json, that I am loading from resources with bodyString.
I am doing that in example below, but it’s not working
`
package org.lnu.is.integration.address.types
import io.gatling.core.Predef.checkBuilder2Check
import io.gatling.core.Predef.findCheckBuilder2ValidatorCheckBuilder
import io.gatling.core.Predef.jsonFile
import io.gatling.core.Predef.scenario
import io.gatling.core.Predef.stringToExpression
import io.gatling.core.json.Jackson
import io.gatling.http.Predef.bodyString
import io.gatling.http.Predef.http
import io.gatling.http.request.ELFileBody
import io.gatling.http.request.RawFileBody
import java.io.Console
import scala.io.Source
import org.apache.commons.io.IOUtils
object AddressTypeIntegrationTest {
val is = Thread.currentThread().getContextClassLoader().getResourceAsStream(“response/address/types/expected.json”);
val response = Source.fromInputStream(is).mkString
println("expected: " + response);
val scn = scenario(“Address type get scenario”)
.exec(http(“Address Types Get Paged Result”)
.get("/addresstypes")
.check(bodyString.is(response))
)
}
`
The error I am receiving is
`
Request ‘Address Types Get Paged Result’ failed: bodyString.find.is({
“offset”: 0,
“limit”: 20,
“count”: 2,
“resources”: [
{
“id”: 1,
“name”: “Реєстрації”,
“abbrName”: “реєстр.”,
“uri”: “/addresstypes/1”
},
{
“id”: 2,
“name”: “Поштова”,
“abbrName”: “пошт.”,
“uri”: “/addresstypes/2”
}
],
“uri”: “/addresstypes”
}), but actually found {
“offset” : 0,
“limit” : 20,
“count” : 2,
“resources” : [ {
“id” : 1,
“name” : “Реєстрації”,
“abbrName” : “реєстр.”,
“uri” : “/addresstypes/1”
}, {
“id” : 2,
“name” : “Поштова”,
“abbrName” : “пошт.”,
“uri” : “/addresstypes/2”
} ],
“uri” : “/addresstypes”
}
`