2

please consider the scenario...

I am creating script of CreateNewFolder of my web application.

    .exec(http("request_")
        .post("/url/home")
        .formParam("action_id", "9")
        .formParam("projectId", "${projectId}")
        .formParam("isForEdit", "false")
        .check(jsonPath("$.distData.roleList[25].roleId").saveAs("roleId"))
        .check(jsonPath("$.distData.userList[10].userID").saveAs("userID")))
    .exec(http("Create_New_Folder")
        .post("/url/home")
        .formParam("action_id", "7")
        .formParam("projectId", "${projectId}")
        .formParam("folderId", "0")
        .formParam("AdminRoleId", "${roleId}")
        .formParam("isWorkspace", "1")
        .formParam("extra", """{"folderName":"+dateTime+","security":{"defaults":[{"name":"defalt","acessId":1}],"users":[{"hashedUserId":"${userID}","userName":"User112"}],"roles":[{"roleId":"${roleId}","roleName":"Administrator"}]}}"""))
    .pause(3) 

Can anyone guide me, why is this happening???

full error message: "jsonPath($.distData.roleList[25].roleId).find(0).exists failed, could not prepare: Boon failed to parse into a valid AST: -1"

Your help would be much appreciated.

thanks, Praveen Mourya

Praveen
  • 300
  • 5
  • 15

1 Answers1

2

Your HTTP response payload is not JSON.

Stephane Landelle
  • 6,990
  • 2
  • 23
  • 29
  • Hi Stephane, I'm big fan of yours. How can I fix it??? And what is JSON payload??? – Praveen Aug 04 '16 at 11:00
  • Please guide me. I'm learner of scala and gatling as well. I've tried many scenarios but those didn't work. I've created CreateNewFolder simulation and it is working fine for me but I can't help myself to resolve this error. – Praveen Aug 04 '16 at 11:09
  • I think what Stephane means to say is the reponse you receive with your request is not a valid JSON. Therefore jsonPath fails on trying to parse your response. Can u try to use this [example](http://stackoverflow.com/questions/27514947/parsing-a-json-response-returned-to-gatling) to additionally println your result after saving it to the session to verify the assumption? – Dr4gon Jan 05 '17 at 17:19