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 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")

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like