cancel
Showing results for 
Search instead for 
Did you mean: 

HTML report issue.

SOLVED
Contributor

HTML report issue.

I want to capture test information of Test cases,for that i designed script and able to print all test steps information for the corrosponding Test Case.now when tried to extend the script for method,statuscode and EndpointURL ,Igot 1 error which I am unable to fix.Please help.

attached error detail for references.

script detail:-

def testStepName
def method
def statusCode
def endpointURL

testCase.testStepList.each{
testStepName = it.name
method = it.getHttpRequest().getResponse().getMethod()
statusCode = it.testRequest.response.responseHeaders["#status#"][0]
endpointURL = it.getHttpRequest().getResponse().getURL()

log.info testStepName
log.info method
log.info statusCode
log.info endpointURL
}

1 ACCEPTED SOLUTION

Accepted Solutions
Occasional Contributor

Re: HTML report issue.

Hi,

in your script, you try to get the method, statusCode and endpointURL for each test step. But, expect Request_GlobalOffersAvailable_Flag that probably contains all these values, the other steps does not seem to have such info as they are Groovy step and DataSource steps.

 

Try to separate the logic there, to get the values only for the proper step, with something like this:

 

def testStepName
def method
def statusCode
def endpointURL

testCase.testStepList.each{
testStepName = it.name
if(testStepName == "Request_GlobalOffersAvailable_Flag") {
	method = it.getHttpRequest().getResponse().getMethod()
	statusCode = it.testRequest.response.responseHeaders["#status#"][0]
	endpointURL = it.getHttpRequest().getResponse().getURL()
	log.info method
	log.info statusCode
	log.info endpointURL
}

log.info testStepName
}

 

View solution in original post

1 REPLY 1
Occasional Contributor

Re: HTML report issue.

Hi,

in your script, you try to get the method, statusCode and endpointURL for each test step. But, expect Request_GlobalOffersAvailable_Flag that probably contains all these values, the other steps does not seem to have such info as they are Groovy step and DataSource steps.

 

Try to separate the logic there, to get the values only for the proper step, with something like this:

 

def testStepName
def method
def statusCode
def endpointURL

testCase.testStepList.each{
testStepName = it.name
if(testStepName == "Request_GlobalOffersAvailable_Flag") {
	method = it.getHttpRequest().getResponse().getMethod()
	statusCode = it.testRequest.response.responseHeaders["#status#"][0]
	endpointURL = it.getHttpRequest().getResponse().getURL()
	log.info method
	log.info statusCode
	log.info endpointURL
}

log.info testStepName
}

 

View solution in original post

New Here?
Join us and watch the welcome video:
Top Kudoed Authors