Reputation: 591
CSV file:
requestParam
string
string2
string3
I keep trying to get a value from an array of records like this:
ScenarioBuilder scn = scenario("Batch Processing Example")
.repeat(1).on(
feed(csvFeeder, 10).exec(session -> {
for (int i = 0; i < 10; i++) {
String requestParam = session.getString("requestParam");
System.out.println(requestParam); // THIS DOES NOT WORK
}
return session;
})
.exec(
//Not important
)
);
I am still getting this: [Ljava.lang.Object;@4ebc2694
However, it works when I do not divide these records like this:
ScenarioBuilder scn = scenario("Batch Processing Example")
.repeat(1).on(
feed(csvFeeder).exec(session -> {
String requestParam = session.getString("requestParam");
System.out.println(requestParam);
return session;
})
.exec(
//Not important
)
);
Can you tell me what I did wrong?
Upvotes: -1
Views: 45
Reputation: 6623
First, you're using an outdated version of Gatling as since 3.10.0, Gatling no longer generates arrays in this case.
Then, as explained in the official documentation:
It’s also possible to feed multiple records at once. In this case, values will be Java List or Scala Seq containing all the values of the same key.
So in your case, requestParam
is not a String
but a List<String>
and it's on this List
you have to iterate on.
Upvotes: 0