Forum Discussion

hrshilpashree's avatar
hrshilpashree
Occasional Contributor
5 years ago

Can we create a log(separate log file) through script?

Hi All,

 

Can we create a log (Project .log) through script? I have different test cases running through same function, so need to create a log (new log file )through code for each test cases?

 

  • AlexKaras's avatar
    AlexKaras
    5 years ago

    Hi,

     

    Is it possible to export just the logs in particular folder through script. 

    Not sure that I got the question, but nevertheless: the log can be exported (manually or via Log.SaveResultsAs() ) as a whole only.

    To get a part of the log, you can export the whole log and parse it manually then.

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    No this is not possible.

    Consider Log.AppendFolder() or aqTestCase  object.

     

    • hrshilpashree's avatar
      hrshilpashree
      Occasional Contributor
      Thank you Alex.. Is it possible to export just the logs in particular folder through script. we can manually export ( export current row),can we do it through code?
      • leonmoto's avatar
        leonmoto
        Occasional Contributor

        Hello.

         

        Yes, you can export your logs to a specific path via

         

        Log.SaveResultsAs(FileNameLogFormatExportVisualizerImagesLogScope)

         

        FileName would be the path to your file destination e.g. C:\Users\Public\Documents\mylog.mht

         

        But remember that you can not simply export certain rows if you use a encrypted mht file, therefore you should probaly use the HTML format.

         

        lsHTML1HTML format – a web page with accompanying images, stylesheets and other data files. The FileName parameter specifies the folder to save the files. The web page name is index.htm.

         

        Greetings Leon