Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 20990

Add HTTP headerfield to Requests

$
0
0

Hi All,

 

I'm using Ready API 1.5.0 for testing REST API calls. Came across this Groovy-script that seems to be useful to add a HTTP-header field to all teststeps. I'm executing it on Project-level fot all TestSuites and TestSteps in that area. The remark that it only should work in 3.5.1 sounds a bit odd to me; executing the script results in the error attached to this message. How can I get this script to work properly in SOAP UI NG?

 

// Add HTTP headers to Requests
// NOTE: will work only in 3.5.1 version

import com.eviware.soapui.impl.wsdl.teststeps.*
import com.eviware.soapui.support.types.StringToStringMap;

def tc = testRunner.testCase.testSuite.getTestCaseByName("<TESTCASE_NAME>")
def ts = tc.getTestStepByName("<TESTSTEP_NAME>")

def headers = new StringToStringMap()

headers.putIfMissing("PmAuthenticationToken","<TOKEN>")
log.info ts.getHttpRequest().setRequestHeaders(headers)

 


Viewing all articles
Browse latest Browse all 20990

Trending Articles