Hi,
I have two scenarios in my script. I want to pass value of “CreateId” to 2nd scenario. I have saved “CreateId” in 1st scenario.
Error says:
No attribute named ‘CreateId’ is defined
jsonPath($.id).find(0).exists, found nothing
Scenario - 1
val create = scenario("Create")
.exec(http("post_request_create")
.post("/api/asdf")
.headers(headers_10)
.body(StringBody(session =>s"""{"name": "${randomName()}"}""")).asJSON
.check(jsonPath("$.id")
.saveAs("CreateId"))
)
Scenario - 2
val addTerm = scenario("Add Term")
.repeat (repeatCount){
exec(http("Add")
// NOT WORKING
//.post("""/api/asdfg/${thesaurusid}/terms""")
// NOT WORKING
.post(session => "/api/asdfg/" + session.get("CreateId").asOption[String] + "/terms")
.headers(headers_10)
.body(StringBody(session =>s"""{...somedata...}"""))
)
}
val scn = List(create.inject(atOnceUsers(1)),addTerm.inject(nothingFor(10 seconds), atOnceUsers(userCount)))
setUp(scn).protocols(httpProtocol)