Forum Discussion
nmrao
4 years agoChampion Level 3
Events can be used in this case.
Implement script for beforeSubmit of SubmitListener. Access the request and remove the unwanted and reassign the request with changed request.
Implement script for beforeSubmit of SubmitListener. Access the request and remove the unwanted and reassign the request with changed request.
- nmrao4 years agoChampion Level 3
Here is the example script that should do what you are looking for.
Place the same for SubmitListener.beforeStep
import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep import groovy.json.JsonSlurper import groovy.json.JsonOutput def temp = context.getProperty('wsdlRequest') def isSendNegativeValues = context.expand('${#TestCase#SEND_NEGATIVE_VALUE}') ?: 'false' if ('false' == isSendNegativeValues && temp && (context.getProperty('wsdlRequest').parent instanceof RestTestRequestStep)) { def request = context.wsdlRequest.requestContent def json = new JsonSlurper().parseText(request) def newRequest = JsonOutput.toJson(json.findAll {it.id > 0}) if (newRequest && request != newRequest) { context.wsdlRequest.requestContent = newRequest } }
However, what do you like to do if you want to send ids with negative values ever? It is not mentioned.
You can define test case level custom property SEND_NEGATIVE_VALUE with value true, so that the request is not filter any data. By default, the above script filters with ids of negative values.
Related Content
- 3 years ago
- 6 months ago
- 2 years ago
Recent Discussions
- 3 hours ago
- 17 days ago