CSV feeder usage - With Group

Hello Gatling experts,

I am seeing error listed below, when trying to run Gatling test using CSV feeder along with group statement.

No attribute named ‘searchCriterion’ is defined

Could you please advise, how should I use resolve this issue

Please could you advise if there is any way of adding multiple group statements in single val

eg: val Search = group (“Home page “){
exec(http(“request_0”)
.get( “””/assets/scripts/vendor/jquery/dist/jquery.min.map”"")

class TestSimulation extends Simulation {

object Search {

val feeder = csv(“search.csv”).random // This feeder has column searchCriterion

// launch home page
val searchHome = group(“Home Page”){

exec(http(“request_0”)
.get( “”"/assets/scripts/vendor/jquery/dist/jquery.min.map""")
.headers(headers_0)
.resources(http(“request_1”)
.get(uri1 + “”"/assets/styles/bootstrap.css.map""")
.headers(headers_0),
http(“request_2”)
.get(uri1 + “”"/assets/styles/bootstrap-theme.css.map""")
.headers(headers_0)))
}

.pause(6)

//search using CSV feeder
val searchWord = group(“search”){

feed(feeder)
.exec( session => {
println( "USER: " + session(“searchCriterion”).as[String] )
println( "PASSWORD: " + session(“searchComputerName”).as[String] )
session
})
exec( http(“request_3”)

.get("""/search""")

.queryParam(""“q”"","${searchCriterion}")
//.get("""/search?q="${searchterm}""")
.headers(headers_3)
.resources(http(“request_4”)
.get(uri1 + “”"/assets/styles/bootstrap.css"""),
http(“request_5”)
.get(uri1 + “”"/assets/styles/bootstrap-theme.css"""),
http(“request_6”)
.get(uri1 + “”"/assets/styles/main.css"""),
http(“request_7”)
.get(uri1 + “”"/assets/images/responsive/betalogo-small.png"""),
http(“request_8”)
.get(uri1 + “”"/assets/images/Scottish_Government_logo.png"""),
http(“request_9”)
.get(uri1 + “”"/assets/images/govuk-crest-text.png"""),
http(“request_10”)
.get(uri1 + “”"/assets/scripts/vendor/jquery/src/jquery-1.11.1.js"""),
http(“request_11”)
.get(uri1 + “”"/assets/scripts/vendor/bootstrap/dist/js/bootstrap.min.js"""),
http(“request_12”)
.get(uri1 + “”"/assets/scripts/vendor/bootstrap/dist/js/ie10-viewport-bug-workaround.js"""),
http(“request_13”)
.get(uri1 + “”"/assets/scripts/vendor/require.js/require.js"""),
http(“request_14”)
.get(uri1 + “”"/assets/fonts/glyphicons-halflings-regular.woff"""),
http(“request_15”)
.get(uri1 + “”"/assets/fonts/fira/FiraSans-Regular.woff"""),
http(“request_16”)
.get(uri1 + “”"/assets/fonts/fira/FiraSans-Medium.woff"""),
http(“request_17”)
.get(uri1 + “”"/assets/styles/bootstrap.css.map""")
.headers(headers_0),
http(“request_18”)
.get(uri1 + “”"/assets/styles/bootstrap-theme.css.map""")
.headers(headers_0),
http(“request_19”)
.get(uri1 + “”"/assets/scripts/main.js"""),
http(“request_20”)
.get(uri1 + “”"/assets/scripts/app/search.js"""),
http(“request_21”)
.get(uri1 + “”"/assets/scripts/app/gup.js"""),
http(“request_22”)
.get(uri1 + “”"/assets/scripts/app/ajax.js"""),
http(“request_23”)
.get(uri1 + “”"/assets/scripts/vendor/require-handlebars-plugin/hbs.js"""),
http(“request_24”)
.get(uri1 + “”"/assets/scripts/vendor/jquery/dist/jquery.min.js"""),
http(“request_25”)
.get(uri1 + “”"/assets/scripts/vendor/require-handlebars-plugin/hbs/handlebars.js"""),
http(“request_26”)
.get(uri1 + “”"/assets/scripts/vendor/require-handlebars-plugin/hbs/underscore.js"""),
http(“request_27”)
.get(uri1 + “”"/assets/scripts/vendor/require-handlebars-plugin/hbs/i18nprecompile.js"""),
http(“request_28”)
.get(uri1 + “”"/assets/scripts/vendor/require-handlebars-plugin/hbs/json2.js"""),
http(“request_29”)
.get(uri1 + “”"/assets/scripts/vendor/jquery/dist/jquery.min.map""")
.headers(headers_0),
http(“request_30”)
.get(uri1 + “”"/assets/scripts/templates/searchresults.hbs"""),
http(“request_31”)
//.get(uri1 + “”"/service/search/?q="${searchterm}"&from=&size=""")
.get(uri1 + “”"/service/search/""")
.queryParam(""“q”"","${searchCriterion}")
.headers(headers_31)))

}

val scn = scenario(“RecordedSimulation”).forever()(

randomSwitch(

// 50.0 → Search.searchHome,
50.0 → Search.searchWord

)
)

setUp(
//scn.inject(constantUsersPerSec(0.18) during(360)))

scn.inject(rampUsers(28) over (60 seconds))) //,
//constantUsersPerSec(0.15) during (1600 seconds)))
//scn.inject(constantUsersPerSec(0.18) during (120)))

.protocols(httpProtocol)
.maxDuration(30 seconds)

}

}

Sorry for mistakenly sending incomplete email earlier. Updated now.

Hello Gatling experts,

I am seeing error listed below, when trying to run Gatling test using CSV feeder along with group statement.

No attribute named ‘searchCriterion’ is defined

Could you please advise, correct usage of feeder in Group statement.

Please could you also advise if there is any way of adding multiple group statements in single val

eg: val Search = group (“Home page “){
exec(http(“request_0”)
.get( “””/assets/scripts/vendor/jquery/dist/jquery.min.map”"")

},
group(“Search for Term”){
feed(feeder)
exec(http(“Request_x”)
.get(xxxxx)
.queryparam("""“q”""","${searchCriterion}")
}

Could you post a gist of your full Simulation, please?

Hello Stéphane,

Thanks for quick response.

Please find below Gist url

https://gist.github.com/ca739aae3ad9133b2aef.git

Thanks & Regards,
Rajesh

Missing leading dot, so feed is just discarded instead of being chained:
https://gist.github.com/rajesh825/ca739aae3ad9133b2aef#file-testsimulation-scala-L56

Hi Raj,

Static files (.js, .png, .css etc) are normally cached at a CDN or somewhere and I wondered if it was worth including those in your test?

Aidy

Hi Lewis,

The test site I am using does not use CDN, that’s the reason I’m trying to simulate loading all static files.

Regards,
Rajesh