I am testing a Rest API
using SOAP UI
tool.
First, I hit another API which gave me the jSessionid and then in my actual
You can easily manipulate Cookies using Groovy scripting. In SoapUI, Cookies are kept in the Cookie store:
import com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport
def myCookieStore = HttpClientSupport.getHttpClient().getCookieStore()
You can read all the Cookies in there:
def myCookies = myCookieStore.getCookies()
def interestingCookie
myCookies.each {
if(it.name == "JSESSIONID")
interestingCookie = it
}
To create a new Cookie in another request:
import org.apache.http.impl.Cookie.BasicClientCookie
def myNewCookie = new BasicClientCookie("cookie_name", "cookie_value")
myNewCookie.version = 1
myNewCookie.domain = "qa.test"
myCookieStore.addCookie(myNewCookie)
I have some additional information in an older blog post here.