Forum Discussion

amarnath1234's avatar
amarnath1234
Contributor
6 years ago
Solved

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...
  • KonstantinosLps's avatar
    6 years ago

    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
    }