Trying to check if a string exists on the body. Similar to checking status which is .check(status.is(200))
. I want to check for string as well. tried .check(bodyString.is("greeting"))
but got an error:
val scn = scenario("GreetingPages")
.during(testTimeSecs) {
exec(
http ("greeting")
.get("/greeting")
.check(status.is(200))
.check(bodyString.is("Greeting"))
).pause(minWaitMs,maxWaitMs)
.exec(
http("greeting1")
.get("/greeting1")
.check(status.is(200))
.check(bodyString.is("Greeting1"))
).pause(minWaitMs,maxWaitMs)
.exec(
http("Third page")
.get("/greeting2")
.check(status.is(200))
.check(bodyString.is("Greeting2"))
).pause(minWaitMs,maxWaitMs)
}
---- Errors --------------------------------------------------------------------
bodyString.find.is(Greeting), but actually found {"message":"G 9 (47.37%) reeting"} bodyString.find.is(Greeting1), but actually found {"message":" 5 (26.32%) Greeting1"} bodyString.find.is(Greeting2), but actually found {"message":" 5 (26.32%) Greeting2"}
.check(substring("greeting").exists)
– anasmi