-1

Hi team am new to serenity. Let's say am storing this data as follows

Serenity.setSessionVariable("User Name").to("userKey");

Now in a scenario if I call this key like this Serenity.sessionVariableCalled("userKey") from a different step definition in a different class will I get the value saved?.

Nordle
  • 2,915
  • 3
  • 16
  • 34
Ajeesh
  • 25
  • 1
  • 5

2 Answers2

1

if it is a scenario different from which you call the session variable, it is not possible. the scenarios are independent -> SOLID

xPlauNx
  • 11
  • 1
0

It should return that object, but you may need to typecast it. Also Serenity.sessionVariableCalled("userKey") is calling return (T) getCurrentSession().get("objectKey")

  • Please see [How do I write a good answer?](https://stackoverflow.com/help/how-to-answer) from StackOverflow Help. – coderpc Dec 20 '19 at 22:17