Hi folks,
I am trying to find a way to set the request name based on the query type in the data set dynamically. Here is the scenario example:
val feeder = csv(dataFilePath).unzip.random
val scenario: ScenarioBuilder = scenario(“Search”)
.feed(feeder)
.exec(http(“search”)
.get("${query}"))
How can I achieve it?
Thanks,
Maruf
Just like the same way you’ve set the url dynamically.
Hi Stephen,
Thanks for the quick response.
Actually, I am trying to pass query from feed data to a function and parse it to find out what type of query it is and set the request name. Something like this:
val scn1: ScenarioBuilder = scenario("Search")
.feed(feeder)
.exec(http(getRequestName("${query}"))
.get("${query}"))
def getRequestName(request: String): String = {
val list = request.stripPrefix("/").trim().stripTrailing().split("[?]")
val name = list(0)
println(name)
name
}
if a query is '/query_normalize?query=radio&response.type=basic&acce… ’ I expect it to return ‘query_normalize’ but it returns full query:
“> /query_normalize?query=radio&response.type=basic&acce… (OK=1 KO=0 )”
What am I doing wrong here?
Regards,
Maruf