Question & Answer
How can you use custom code to explicitly set the Cookie in IBM® Rational® Performance Tester (RPT)?
In RPT if a request in the script contains a "Cookie" entry in the Request Headers, the corresponding Cookie name and value will be included in the request on all subsequent playbacks. In this case, the Cookie was "created" by the client (with a Java applet for example) during recording instead of being supplied by the server.
A user should be able to modify the value of a Cookie (as opposed to a ServerSuppliedCookie) in the header just like you can modify other strings. Please find the sample custom code below to explicitly set the Cookie. Note that httpInfo.getCookieCache().setCookie() class uses the undocumented IHTTPVirtualUserInfo interface. Since RPT does not document this, it is subject to change without notice.
When creating the new Cookie, it will use the same Path and Domain (either explicitly supplied or default) as the original, server-supplied Cookie.
16 June 2018