I have a feeder containing some data, for example:
name jack jim jomana
And I want to send a request that simulate the name search action
1- user start to enter the fisrt letter of the name
2- then the 3 other letters
so the requests that I want to send : get ( https/bla/bla/search?q=here I want only the first letter of the name)
get ( https/bla/bla/search?q=here I want only the 3 first letters of the name)
I know that substring(start,end) works well but my problem how can I apply it on "${name}" because when I do "${name}".substring(0,1) => in this situation "${name}" doesn't retrive name value "jack"
Infos: I m using scala with gatling
when I do "${name}".substring(0,1) => in this situation "${name}" doesn't retrive name value "jack"
You can create additional action with logic which will produce the values that you need:
.exec { session =>
val name = session("name").as[String]
val firstPartOfName = name.substring(0, 1)
val secondPartOfName = name.substring(1, 4)
session
.set("firstPartOfName", firstPartOfName)
.set("secondPartOfName", secondPartOfName)
}
.exec("...search?q=${firstPartOfName}")
.exec("...search?q=${secondPartOfName}")