Forum Discussion

latosdforlife's avatar
latosdforlife
New Contributor
8 years ago

While running a test item, how can I wipe the log and start a new log from scratch?

Hi everyone,

 

Thank you in advance for your help!

 

My goal is to run one Test Item and have multiple files saved from that one run. I know I can save off multiple files by using Log.SaveResultsAs.

 

However, I do not want the second log file to contain any messages from the first file. Also, the third file should not contain any of the previous two log files. Any time I save off, I want to wipe the log and start a new one from scratch.

 

Is there an easy way to do this? 

 

Thank you!

1 Reply

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Not really as far as I am aware.  The log information for a test run is kept in memory and I think the log file itself is kept open on some level during the test run.

     

    What's the end goal for having multiple files saved off? Is this for import into some other process, some other report structure, etc?

    Something you could consider doing is wrapping each set of tests in a "folder" in the test log.  While this does not create multiple files, it encapsulates a set of tests/steps into a tree node in the log file that can then be expanded or collapsed as desired for readability.  So, if strict files isn't necessary, this could be a solution to keep information from one set of tests separate from another.

     

    Here's code that I use pretty regularly for this sort of thing:

     

    function beginlog(StepDescription)
    {
        Log.AppendFolder(StepDescription);
        Indicator.PushText(StepDescription);
    }
    
    function endlog()
    {
        Indicator.PopText();
        Log.PopLogFolder();
    }