Forum Discussion

mikelios's avatar
13 years ago

Adding cookie to TestRunContext

Disclaimer: I'm a soapUI/Groovy newbie, so I appreciate your patience.

In the past, our team has used soapUI 1.7.6 and 3.6.1, and we are now attempting to use 4.5.1.

The problem we are experiencing is adding a cookie to the TestRunContext. In the past we had a Groovy script which created a Cookie based off a WSL authentication url, and then added that Cookie to the Test Run Context.

With versions 1.7.6 and 3.6.1, this worked fine by creating a 'state' variable as following:
def state = context.getProperty(com.eviware.soapui.model.testsuite.TestRunContext.HTTP_STATE_PROPERTY);

This returned a org.apache.commons.httpclient.HttpState object which we then executed the following method:

state.addCookie(wslCredential); // where wslCredential is the cookie we created earlier

Now, with soapUI 4.5.1, this doesn't work because the context.getProperty.. method returns a org.apache.http.protocol.BasicHttpContext object, which of course does not have an addCookie method.

I don't know if I ran into a soapUI bug, or if (more likely) there is a different approach to adding the cookie to the TestRunContext.

I would appreciate any advice on this issue.
No RepliesBe the first to reply