I am struggling to set new value for each session using set session method and pass it to the variable for next call of the same api.
I can see that new values are generated from my functions every time I print the temp params but after API call I see still only first value is passed for all sessions and new values are not assigned.
Is it possible to help ?
are there any documentations for this kind of scenario where we want to pass values without csv.
class TEST_APP_NEW extends Simulation {
/*set value for first time */
var refreshtoken: String = new OIDCAuthentication.getAccessToken()
val clientId="1234568990"
val callbackUrl="http://localhost/test/callback"
val codeVerifierformat = new OIDCAuthentication.getVerifier()
val code = new OIDCAuthentication.getCode(codeVerifiersocoformat)
val codeVerifier = codeVerifierformat.getValue
val httpProtocol = http
.baseUrl("https://baseurl")
.inferHtmlResources()
.acceptHeader("*/*")
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("en-US,en;q=0.5")
.userAgentHeader("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0")
.shareConnections
val header_Stores = Map(
"Content-Type" -> "application/x-www-form-urlencoded")
val scn = scenario("TEST_APP_NEW")
.exec ( session => {
println(s"Code :", code)
println(s"code_verifier:",codeVerifier)
session
})
.exec(http("TOKENTEST")
.post("/op/oidc/token")
.headers(header_Stores)
.formParam("client_id", s"$clientId")
.formParam("code", s"$code")
.formParam("redirect_uri", s"$callbackUrl")
.formParam("code_verifier",s"$codeVerifier")
.formParam("grant_type", "authorization_code")
.check(status.is(200))
.check(bodyString.saveAs("TOKENS"))
.check(jsonPath("$.access_token").saveAs("access_token"))
)
/*reassigning values for next sessions or requests */
.exec ( session => {
val codeVerifierformatter = new OIDCAuthentication.getVerifier()
val codeNEW = new OIDCAuthentication.getCode(codeVerifierformatter)
val codeVerifierNEW = codeVerifierformatter.getValue
session.set("code", codeNEW)
session.set("codeVerifier", codeVerifierNEW)
session
})
Hi @slandelle Thanks for the documentation
I have tried as below
exec { session =>
val codeVerifierformatter = new OIDCAuthentication.getVerifier()
val codeNEW = new OIDCAuthentication.getCode(codeVerifierformatter)
val codeVerifierNEW = codeVerifierformatter.getValue
val newSession = session.setAll((“code” → codeNEW),(“codeVerifier” → codeVerifierNEW))
println(newSession)
newSession
}
But still new values are not passed at all . My first request only pass and rest fails with 400 bad request since the same old values passes for all sessions.