Hi,
The basicAuth is same for every user (just for test & acc).
So I can try the HttpProtocolConfig.
I had this solution for now:
class Requests(env:Env) {
val authenicate_user = “secret”
val authenticate_pass = “alsosecret”
val authenticateURL = env match {
case TST => true
case ACC => true
case _ => false
}
def getrequest(name:String, url:String):GetHttpRequestBuilder = http(name).get(url)
def postrequest(name:String, url:String) = http(name).post(url)
def authenticatedGetRequest(name:String, url:String) = getrequest(name,url).basicAuth(authenicate_user,authenticate_pass)
def authenticatedPostRequest(name:String, url:String) = postrequest(name,url).basicAuth(authenicate_user,authenticate_pass)
def request(name:String, url:String,verb:Verb) = (authenticateURL,verb) match {
case (false,GET) => getrequest(name,url)
case (false,POST) => postrequest(name,url)
case (true,GET) => authenticatedGetRequest(name,url)
case (true,POST) => authenticatedGetRequest(name,url)
}
val homepage = request(“homepage”,"/",GET)
val bidOnLot =
request(“bid on lot”,"/lots/bid/4/61", GET).queryParam(“prefillNextBidAmount”,“true”).check(status.is(302))
calling in my Scenarios file exec(requests.homepage)
Works fine.
exec(requests.bidOnLot) fails with
overloaded method value exec with alternatives:
(chains: Iterable[com.excilys.ebi.gatling.core.structure.ChainBuilder])com.excilys.ebi.gatling.core.structure.ScenarioBuilder
(chains: Iterator[com.excilys.ebi.gatling.core.structure.ChainBuilder])com.excilys.ebi.gatling.core.structure.ScenarioBuilder
(chains: com.excilys.ebi.gatling.core.structure.ChainBuilder*)com.excilys.ebi.gatling.core.structure.ScenarioBuilder
(actionBuilder: com.excilys.ebi.gatling.core.action.builder.ActionBuilder)com.excilys.ebi.gatling.core.structure.ScenarioBuilder
(sessionFunction: com.excilys.ebi.gatling.core.session.Session => com.excilys.ebi.gatling.core.session.Session)com.excilys.ebi.gatling.core.structure.ScenarioBuilder
cannot be applied to (ScalaObject)
15:14:15.655 [ERROR] c.e.e.g.a.ZincCompiler$ - .exec(requests.bidOnLot)
15:14:15.656 [ERROR] c.e.e.g.a.ZincCompiler$ - ^
15:14:15.701 [ERROR] c.e.e.g.a.ZincCompiler$ - one error found
Exception in thread “main” Compilation failed
I do not quite understand, the only difference is I enriched the httpGetBuilder instance with queryParam and a check.
Alex