In my test I need to use a header in base64 ( ex : Authorization" → “Basic ${token}” )
In order not to be accessible by everyone in the repository, I use it as a jenkins variable.
I pass that parameters from the command line to the Simulation with JAVA_OPTS
then in my simulation
val token = System.getProperty(“Basictoken”)
val scn = scenario(“test”)
feed(token)
.exec(…
However I get an error when I want to pass it to Feed :
overloaded method value feed with alternatives:
(feeder: io.gatling.core.feeder.Feeder[Any])io.gatling.core.structure.ChainBuilder
(feederBuilder: io.gatling.core.feeder.FeederBuilder)io.gatling.core.structure.ChainBuilder
cannot be applied to (String)
So this specific needed headers with $token is call in one of this Def, not all , but it can’t find it even using : .header(“Authorization”, s"Basic $token")
First, are you sure the token value is well filled? (try printlin it)
The error “not found: value token” seems like what you get when it is an EL and gatling tried to get from session. (without the s in front of the string), it is feasible to add it to the session but it is not the point I discuss here.
Def1 is a function (if I believe the parentheses pair after), you can give token as an argument to it, and in your Def1 add the header.
As in the documentation, you can prepare the headers
class MySimulation extends Simulation {
val authorizationHeaders = Map(“Authorization” → s"Basic $token")
println(authorizationHeaders)
val scn = scenario(“test”)
.repeat(10) {
feed(somefeed)