Reputation: 69
I have the request which uses in-line script:
<Req>
<TransactionId>${= new Date().format("yyyy_MM_dd_HH_mm_ss_SSS")}</TransactionId>
</Req>
How can I log value of TransactionId or whole request?
Upvotes: 0
Views: 699
Reputation: 21379
Create a Script Assertion
for the same test step.
And add the below code to achieve the same i.e., logs the entire request:
log.info context.rawRequest
In order to get the TransactionId
, you can parse the request and extract the value with below code:
def xmlRequest = new XmlSlurper().parseText(context.rawRequest)
def tId = xmlRequest.'**'.find {it.name = 'TransactionId'}?.text()
log.info "Transaction id sent in the request is: $tId"
Upvotes: 1