Forum Discussion

klusht's avatar
klusht
Occasional Contributor
11 years ago

Getting the submit error message from assertions

Hi ,

Is there any way to reach the submit error message from a groovy script assertion ?
I would like to use that information to create checks.

for more additional details , I am referring to the message that is posted to error log tab, or under the request window , for example the: " Error getting respose; javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake ".

This is a legit test case and would like to parse the message and use it.

Thanks.
klusht
  • Cizo89's avatar
    Cizo89
    Frequent Contributor
    Hi klusht,

    you can access the error log via this script:

    import com.eviware.soapui.SoapUI

    def errLog = SoapUI.getLogMonitor().getLogArea("error log")
    def errLogModel = errLog.model

    if (errLogModel.getSize() > 0){
    for (i in 0..errLogModel.getSize() - 1){
    log.info(errLogModel.getElementAt(i))
    }
    } else{
    log.info("No errors were thrown!")
    }


    Regards,
    Marek
  • klusht's avatar
    klusht
    Occasional Contributor
    Hi Marek,

    Thanks a lot for the response.
    This seems to work fine as long as the test cases are executed with the GUI. Thank you for this.

    My curiosity now is to see if there is an additional way to get this info when running test case with the testrunner?

    Thanks,
    klusht