Session variables handling

How do i refer a session variable from one scala file to another?

.exec(session => {
  val token = session("acmToken").as[String]
  val token2 = "Bearer " + token
  session.set("acmToken", token2)
})

I need to use acmToken variable in another class or store in scala variables

Hi @balaji,

As you set acmToken in session, you can retrieve it in another step (even in another scala file) from session as well.

See Session API - Getting Attributes.

As it’s stored in session, ensure that it is from the same virtual user (ie, in the same scenario).

Cheers!

can you please give some examples?
I need to use or store this acmtoken value in another variable

@GeMi provided some examples: Case0009SessionValuesSimulation

Thanks @GeMi :heart:

Cheers!

1 Like

this doesnt help me much as well. Its written in java
Can you please help here.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.