def .exec command

I am continuing to refactor the code. I wrote some basic script for get operations:

def getIt(name: String,
link: String,
queryKey: String,
queryValue: String,
pause: Int) {
.exec(http(nimi).get(link).queryParam(queryKey,queryValue).pause(pause))
}

But I can’t get it to work.

def getIt(name: String,
link: String,
queryKey: String,
queryValue: String,
pause: Int) = {
exec(http(nimi).get(link).queryParam(queryKey,queryValue).pause(pause))
}

= so that your method actually returns something

remove leading dot: that’s for chaining

You probably should have a look at some Scala tutorial, such as https://twitter.github.io/scala_school/

I upgraded it to

def getIt(nimi: String,
link: String,
queryKey: String,
queryValue: String,
pause: Int) = {
exec(http(nimi).get(link).queryParam(queryKey,queryValue).pause(pause))
}

But still I have: value pause is not a member of io.gatling.http.request.builder.HttpRequestBuilder

misplaced )

I fixed the misplaced ), but know as soon as my scenario starts it immediately crashes.
I have
val scn = scenario(“addNew”)
getIt(“somePage”,“url”,“paramKey”,“paramValue”,someInt)

.exec(http(“some url”)

Error message: Scenario addNew is empty

Is there anyway I can use the method getIt to make a normal working scenario?

scenario(“addNew”)

.exec(getIt)