How do I pass the values from the session’s vector?

Hi All,

Below mentioned vector has come in Session from 1st request

Map(myDataId → Vector(223, 217, 218, 217, 223, 214, 220,142,223,136, 223, 146, 146) and could be on n on…

So I would like to use comma separated the values of the vector in the next request

As I did it by this way, but not working!

To get the value I have used below mentioned.

.check(jsonPath("$.elementVOList[*].myDataId ").findAll.saveAs("tempIds)))

To pass the value I have used below mentioned in next request.

.formParam(“myDataId “, “${ tempIds }.mkString(”,”)”)

But I am getting below mentioned string in a log file and it is not working as I wanted.

myDataId: $,{,t,e,m,p,I,d,s,}

Guys – How do I pass comma separated values of vector which stored in session, will you please help me?

Thanks & Regards,

Rushabh

You need to learn some basic scala. Even I am a newbie but you are mixing string interpolation with scala mkString function. It does not work.

Are you trying to use all the CSV (comma seperated values) in your one request or do you just need one.

In earlier case, you can try something like this

`

http("Request with multivaluedQueryParam")
  .get("myUrl")
  .multivaluedQueryParam("multi1", "${foo}") // where foo is the name of a Seq Session attribute
  .multivaluedQueryParam("multi2", session => Seq("foo", "bar"))

`
source: http://gatling.io/docs/2.1.7/http/http_request.html?highlight=formparam#query-parameters

Thank you very much Abhinav. Yes i am trying to learn the basic scala by trail and error.

Yes I want all comma separated values not just one.

It works for me but i want to pass the parameters in post request but .multivaluedQueryParam it passes parameters in get request.

So do we have such method for post request ?

Secondly , Could you point me some document to learn basic scala so that i can improve.

Thanks & Regards,

Rushabh

Multivalued Param should work with post too.

There are plenty of sources online for scala. eg: https://twitter.github.io/scala_school/

Hi Abhinav,

.multivaluedQueryParam it worked for me, but not as i wanted so then i did try with .multivaluedFormParam and it works fine which i wanted.

Thanks a lot for your help.

Rushabh

I amm glad it worked out for you.