cancel
Showing results for 
Search instead for 
Did you mean: 

HTML report issue.

SOLVED
Highlighted
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:
Announcements
Script Wanted
Check out the new challenge!

Create a script to generate a request body based on data from Datasource
for the TechCorner tag.
Your input is appreciated!


Scripts created this month:
- A scriptd to go through all response nodes and check the value of the required field
- A Dispatching script to get responses based on the values in Request Body
- A script to add a new tag and assign it to all TestCases in a TestSuite
Top Kudoed Authors