Forum Discussion
yanice
8 years agoSenior Member
Hello,
It seems that the header configuration on the resources is not uploaded automatically in the Test Steps. I ended up writing a groovy script like it is recommended here.
For your case it will be something like that:
import com.eviware.soapui.support.types.StringToStringMap def headers = new StringToStringMap() headers.put("tui-app-name",'${#Project#tui-app-name}'); testRunner.testCase.testSteps.each { q-> if(q.getValue().config.type.equals("restrequest") || q.getValue().config.type.equals("request")) { q.getValue().getHttpRequest().setRequestHeaders(headers) } }
if you run this groovy script at the beginning all the steps from your current TestCase will be updated with the corresponding value, if you want to add multiple headers you can proceed like the following:
import com.eviware.soapui.support.types.StringToStringMap def headers = new StringToStringMap() headers.put("tui-app-name1",'${#Project#tui-app-name1}'); headers.put("tui-app-name2",'${#Project#tui-app-name2}'); testRunner.testCase.testSteps.each { q-> if(q.getValue().config.type.equals("restrequest") || q.getValue().config.type.equals("request")) { q.getValue().getHttpRequest().setRequestHeaders(headers) } }
Yanice
Related Content
- 12 years ago
- 3 years ago
- 8 years ago
- 4 years ago
Recent Discussions
- 2 days ago
- 2 days ago
- 2 days ago
- 3 days ago