Forum Discussion
skelkar
11 years agoContributor
Hi,
I put it ithis script in test suite tear down script area but not able to log requestids of failed test steps.
May be the request id capturing script I added having issues, have a look .
or ( testCaseResult in runner.results)
{
log.info testCaseResult
testCaseName = testCaseResult.getTestCase().name
log.info "test case name: " + testCaseName
if ( testCaseResult.getStatus().toString() == com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus.FAILED.toString() )
{
log.info "Test case " + testCaseName + " failed"
for (testStepResult in testCaseResult.getResults() )
{
if(testStepResult.getStatus().toString() == com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus.FAILED.toString())
{
def testStep = testStepResult.getTestStep().name
// log.info testStep
//do what needs to be done here to get the response content for the testStep
//*******my script to log the requestId of each failed test step**************
String ReqId = testRunner.testCase.testSteps[testStep].testRequest.response.responseHeaders["RequestId"]
log.info "failed test step: "+ testStep+" RequestId is :"+ ReqId
log.info "requestid of failed step is :"+ReqId
//*******my script to log the requestId of each failed test step**************
}
}
}//end if
}//end for
I put it ithis script in test suite tear down script area but not able to log requestids of failed test steps.
May be the request id capturing script I added having issues, have a look .
or ( testCaseResult in runner.results)
{
log.info testCaseResult
testCaseName = testCaseResult.getTestCase().name
log.info "test case name: " + testCaseName
if ( testCaseResult.getStatus().toString() == com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus.FAILED.toString() )
{
log.info "Test case " + testCaseName + " failed"
for (testStepResult in testCaseResult.getResults() )
{
if(testStepResult.getStatus().toString() == com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus.FAILED.toString())
{
def testStep = testStepResult.getTestStep().name
// log.info testStep
//do what needs to be done here to get the response content for the testStep
//*******my script to log the requestId of each failed test step**************
String ReqId = testRunner.testCase.testSteps[testStep].testRequest.response.responseHeaders["RequestId"]
log.info "failed test step: "+ testStep+" RequestId is :"+ ReqId
log.info "requestid of failed step is :"+ReqId
//*******my script to log the requestId of each failed test step**************
}
}
}//end if
}//end for