Store data in static member variables. The static keyword is basic C# stuff, but it is good to understand it in the context of ST & LR. In ST, you can specify and set ''global'' static variables at the class level:
[Serializable()]
public class TestUserCode : TestEntities
{
public static XmlNode SAMLToken = null;
public static DateTime SAMLExpiry;
...}
These static variables are shared with all instances of TestUserCode for the current vuser. By default for an ST test in LR, class instances are not shared between vusers. This can be confirmed through viewing the log files in LoadRunner for an ST test in results/log. To write to this log from Service Test, use this approach:
if (Script.LRAppender.logTextAppend != null)
Script.LRAppender.logTextAppend(''My log message'');
This means you can do something like get a SAML token once, put it in a static variable, and not get another one for a vuser until it is near expiration. Without the static keyword, these values would be reassigned for each new class instance on the thread.