Serenity Session Variable Usage
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...
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?.
2 Answers
if it is a scenario different from which you call the session variable, it is not possible. the scenarios are independent -> SOLID
It should return that object, but you may need to typecast it. Also Serenity.sessionVariableCalled("userKey") is calling return (T) getCurrentSession().get("objectKey")