Forum Discussion

Manimaran's avatar
Manimaran
Occasional Contributor
12 years ago

Can i export the Script log into an excel file in a separate

Hi

I run the test cases from the excel data file and do all my validations through Groovy. I have many "Log.info (Variables)" to put in the Script Log to see the happenings during my execution. After the test case run, Is it possible to write all the contents in the Script Log panel to a input data excel file by creating a new sheet?

2 Replies

  • Manimaran's avatar
    Manimaran
    Occasional Contributor
    Hi,

    i have used this code and it doesn't print the whole content available in the script log tab. i see some 18 lines of log content is available (each line is printed from the test case as test case log, the content is request and response). but only 15 lines of log content is printing in the file. Please help me if anything is missing.

    def logArea = com.eviware.soapui.SoapUI.logMonitor.getLogArea( "script log" )
    def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
    def projectPath = groovyUtils.projectPath
    def datetime = new Date().format("yyyy-MM-dd'T'HH-mm-ss SSS")
    def logFile = new File(projectPath + "\\logs\\" + datetime + ".txt")
    logFile.write("Script Logs In a file.\r\n")
    if(logArea !=null)
    {
    def model = logArea.model
    if(model.size > 0)
    {
    for(c in 0..(model.size-1))
    {
    logFile.append(model.getElementAt(c).toString() + "\r\n")
    }
    logFile.close()
    }
    }