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

695 views
Skip to first unread message

Rushabh Doshi

unread,
Sep 9, 2015, 7:10:25 AM9/9/15
to Gatling User Group

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

Abhinav Gogna

unread,
Sep 9, 2015, 11:59:49 AM9/9/15
to Gatling User Group
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

Rushabh Doshi

unread,
Sep 10, 2015, 1:22:55 AM9/10/15
to gat...@googlegroups.com
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




--
You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/8WryG78LIBE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Abhinav Gogna

unread,
Sep 11, 2015, 9:02:13 AM9/11/15
to Gatling User Group
Multivalued Param should work with post too.

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

Rushabh Doshi

unread,
Sep 14, 2015, 2:48:35 AM9/14/15
to gat...@googlegroups.com
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


Abhinav Gogna

unread,
Sep 14, 2015, 11:24:44 AM9/14/15
to Gatling User Group
I amm glad it worked out for you.
Reply all
Reply to author
Forward
0 new messages