cancel
Showing results for 
Search instead for 
Did you mean: 

With groovy how can we get the teststeps status with details when it fails ?

SOLVED
Frequent Contributor

With groovy how can we get the teststeps status with details when it fails ?

Hi,

 

with my project i need to know in details which cause errors when a teststep fails.

i checked the soapui-error file, it doesn't contains the details about the error.

Or is there another place where i can check for error log?

 

Thank you

 

1 ACCEPTED SOLUTION

Accepted Solutions
Frequent Contributor

Re: With groovy how can we get the teststeps status with details when it fails ?

Hi @davy ,

you can refer to my reply in another topic: https://community.smartbear.com/t5/SoapUI-Open-Source/How-to-use-a-defined-variable-elsewhere-in-a-G...

 

You did retrieve various running information from test result. I suggest you defined a method to collect running information.

For instance:

import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus

def testStepDetails(teststep) {
    def request, response, method
    def assertions = [:]  // for assertions
    def propsList = []  // for properties

    request = "${teststep.testRequest.getMethod()}  ${teststep.testRequest.response.URL}"

    if (teststep.testRequest.assertionStatus == AssertionStatus.FAILED) {
        response = teststep.testRequest.response.contentAsString
        method = teststep.testRequest.method
        teststep.getAssertionList().each {
            assertions[it.getLabel()] = it.getStatus.toString()
        }
        teststep.testCase.getPropertyList().each {propsList << "${it.name}:${it.value}"}

//return
return """ Case Properties: ${propsList} \r\n Status: -FAIL- \r\n Request: ${request} \r\n Response: ${response} \r\n Assertions: ${assertions} """ }

return "" }

 

Thanks,

/Aaron

 

View solution in original post

Tags (2)
4 REPLIES 4
Community Hero

Re: With groovy how can we get the teststeps status with details when it fails ?

Depends on what assertion have been set and how error is thrown in case of user written script assertions. By default soapUI throws error messages.

By the way, why do you need to access them in the groovy? Where is this groovy script placed? Is it inside the project or running independent groovy script?


Regards,
Rao.
Highlighted
Frequent Contributor

Re: With groovy how can we get the teststeps status with details when it fails ?

It 's running independently but placed inside the project as groovy teststep.

Community Hero

Re: With groovy how can we get the teststeps status with details when it fails ?

Looks there are two topics which is little confusing.
Let us continue on below thread
https://community.smartbear.com/t5/SoapUI-Open-Source/What-is-testPassErrorsSuccess-property/m-p/191...


Regards,
Rao.
Frequent Contributor

Re: With groovy how can we get the teststeps status with details when it fails ?

Hi @davy ,

you can refer to my reply in another topic: https://community.smartbear.com/t5/SoapUI-Open-Source/How-to-use-a-defined-variable-elsewhere-in-a-G...

 

You did retrieve various running information from test result. I suggest you defined a method to collect running information.

For instance:

import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus

def testStepDetails(teststep) {
    def request, response, method
    def assertions = [:]  // for assertions
    def propsList = []  // for properties

    request = "${teststep.testRequest.getMethod()}  ${teststep.testRequest.response.URL}"

    if (teststep.testRequest.assertionStatus == AssertionStatus.FAILED) {
        response = teststep.testRequest.response.contentAsString
        method = teststep.testRequest.method
        teststep.getAssertionList().each {
            assertions[it.getLabel()] = it.getStatus.toString()
        }
        teststep.testCase.getPropertyList().each {propsList << "${it.name}:${it.value}"}

//return
return """ Case Properties: ${propsList} \r\n Status: -FAIL- \r\n Request: ${request} \r\n Response: ${response} \r\n Assertions: ${assertions} """ }

return "" }

 

Thanks,

/Aaron

 

View solution in original post

Tags (2)