Reputation: 23
Im new to Gatling and I'm trying to reuse test scripts I'm using for functional testing I wrote in RestAssured/Java to work with gatling. So what I do to call my login methods is I call them in wrapperForJavaMethods
method(line 4) before calling the last method in "gatling fashion"(line 6 ). If I just put strings as arguments in line 4 it works perfectly well but when I'm trying to use feeder's variable ${login}
is printed, for comparison in line 7(where it makes no logical sense to call feeder's variable I just did it for debugging purposes) data from csv is printed. Is there anyway in which I can pass data from csv feeder to method's parameters or can they only be. called in session?
val csvCredentails = csv("data/data.csv")//1
val scenario = scenario("my custom scenario")//1
.feed(csvCredentails)//3
.exec(wrapperForJavaMethods("${login}","${pass}"))//4
.exec(http("login")//5
.post("/login")//6
.check(status is "${login}")//7
def wrapperForJavaMethods(login: String, pass: String): Unit = {
print("login11 " + username + " pass " + password)
objectOfJavaClass.inputCredentials(username, password)
objecyOfJavaClass.anotherJavaMethod
objecyOfJavaClass.anotherJavaMethod2
objecyOfJavaClass.anotherJavaMethod3
...
}
Upvotes: 0
Views: 1358
Reputation: 6623
Disclaimer: Gatling founder here
First, I'm very skeptical about what you're trying to build.
Then, regarding the code you shared, this is not how Gatling Expression Language works. You would have to resolve your parameters in a function. Please check the Session API.
Upvotes: 2