jty0yt's avatar
jty0yt
Occasional Visitor
6 years ago
Status:
New Idea

Export multiple log files at once

It's very tedious to export one by one when you have tens to hundreds of log files and you want to export all of them. A mass export option would be helpful.

6 Comments

  • PooEd's avatar
    PooEd
    Occasional Visitor

    Omg such a great idea give this man a medal :manvery-happy:

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Question: How do you have hundreds of different log files within the same project?  Each test execution of a project creates one log file... so, at the end of the project, when it completes, you export that log file.  Each time you run the project, you export the current log file.

     

    If you have hundreds of projects in a project suite and want to execute the log for each one... again, the export happens within the project, not at the suite level (suites don't actually execute code, they just contain projects).  So, if you run your project suite, each project that runs will export the desired log.

     

    Guess I'm trying to understand what problem is attempting to be solved.

  • jty0yt's avatar
    jty0yt
    Occasional Visitor

    Defects! With stop on error/stop on warning enabled and having frequent stoppages due to defects or automation issues with your scripts, the log files begin to pile up.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    So... turn off "stop on error/stop on warning" and create your automation to only stop when you want it to.  Then, wrap your execution in try/catch/finally logic so that, when you DO run into an exception that causes you to have to halt the tests, you still export the log.

     

    OR... you could implement "OnStopTest" event handler so that, when the test halts, you will execute log export.

  • Vallalarasu_P's avatar
    Vallalarasu_P
    Frequent Contributor

    Are you looking for something like this, Which exists already.

    Script to Save Logs:

     

    Function SaveLogAsYouWish
    FolderPath = “C:\Desktop\TC_Logs\Log\”
    FileName = aqDateTime.Now
    log.Message FileName
    CurrenTime = aqConvert.DateTimeToFormatStr(FileName,”%d_%m_%Y_%H_%M_%S”)
    Log.Message CurrenTime
    LogFileName = FolderPath & CurrenTime & “_Log.mht”
    Log.Message LogFileName
    call Log.SaveResultsAs(LogFileName, lsMHT)
    End Function

     

    This function creates log and saves without over righting the existing log. Because the file name is created with respect to time stamp.

     

    Added to it, if you keep this script in Events "OnStop of Test" . It resolves. 

     

    Keep this in different project, by sharing different FolderPath 

    FolderPath1: ProjectA\Logs

    FolderPath2: ProjectB\Logs

     

    Regards

    Valla

    https://vallatestcomplete.wordpress.com