Alway get an error "No attribute named 'name' is defined" if try to process multiple lines from csv data feed

Hi,

In my test script I try to process 100 lines data from csv data feed via “private val scn = scenario(“test_scn”).feed(insertFeeder, 100).exec(httpReq)”. But I always get an error “[ERROR] HttpRequestAction - ‘httpRequest-1’ failed to execute: No attribute named ‘name’ is defined”.

Could you please help me to find out the root cause? thank you.

Here is the script:

private val insertFeeder = csv(“test_data.csv”).queue
private val csvHeader = GeneralUtil.readFirstLine("“test_data.csv”")

private val httpConf = http
.baseURL(“http://serviceURL”)
.disableFollowRedirect
.disableWarmUp
.shareConnections

/* Prepare http request */
private var httpReq = http(“insert_request”)
.post("/insert")

for (i ← 0 to 99) {
val paramsInArray = csvHeader.split(",")
for (param ← paramsInArray) {
if (param.equalsIgnoreCase(“name”)) {
httpReq = httpReq.formParam((“name” + “[” + i +"]").el[String] , “${name}”)
}
if (param.equalsIgnoreCase(“url”)) {
httpReq = httpReq.formParam((“url” + “[” + i +"]").el[String] , “${url}”)
}

if (!param.equalsIgnoreCase(“name”) && !param.equalsIgnoreCase(“url”)) {
val firstArg = param + “[” + i + “]”
val secondArg = “${” + param + “}”
httpReq = httpReq.formParam(firstArg, secondArg)
}
}
}

private val scn = scenario(“test_scn”)
.feed(insertFeeder, 100)
.exec(httpReq)

setUp(
scn.inject(
constantUsersPerSec(1) during (1200 seconds)
).protocols(httpConf)
).assertions(global.failedRequests.count.lte(5))

And the data in test_data.csv is:
name,url,price,size,gender
image_1,http://image_1_url,100,xl,male
image_2,http://image_2_url,90,m,female
image_3,http://image_3_url,10,s,female

image_2000,http://image_2000_url,200,xl,male

By the way, if I process only 1 line, it works well.

Please properly read the documentation, the detailed explanation is in there: https://gatling.io/docs/current/session/feeder/

Thank you. I noticed “attribute names, will be suffixed”.

在 2018年6月18日星期一 UTC+8下午2:33:01,Stéphane Landelle写道: