Forum Discussion

Manfred_F's avatar
Manfred_F
Regular Contributor
6 years ago
Solved

read number of recent logs keep from script

hi,

can I read options.engines.log.number of recent logs keep from a script?

i'd like to additionally export .mht log file copies and limit their number..

 

Regards,

Manfred

  • Hi Manfred_F 


    Manfred_F wrote:

    thanks,

    the option seems not to be accessible via script.

    What I tried to is:

    - copy the current log file to .mht, if test is run via TestExecute, and

    - limit the number of .mht log files automatically, as TC limits the number of original logs.

     

    Regards,

    Manfred


     

    If you want to limit the number of MHT files, you can create a script that will do the following:

     

    1) check the number of MHT files in a folder where you store test logs. You can do this via 

    aqFileSystem.GetFolderInfo(<Path>)Files.Count

     

    2) if the number of files is good for you (for example, less than 10), export the test log via

    Log.SaveResultsAs

     

    3) if the number of files isn't good, do some actions with the old MHT files (delete them or move to another folder)

     

    Does this approach work for you?

8 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I'm not sure I understand the question.  What are you trying to do?

    As far as I can tell, that particular option is not accessible via code.

    • Manfred_F's avatar
      Manfred_F
      Regular Contributor

      thanks,

      the option seems not to be accessible via script.

      What I tried to is:

      - copy the current log file to .mht, if test is run via TestExecute, and

      - limit the number of .mht log files automatically, as TC limits the number of original logs.

       

      Regards,

      Manfred

      • m_essaid's avatar
        m_essaid
        Valued Contributor

        Hi Manfred,

         

        What I do is a "mobile supress" of some of my files in some folders.

        I built a generic method that takes in input :

        - a path

        - a file extension

        - a duration (in days)

         

        I call this method every day in several places

        It loops in the folder, and delete every file that matches the extension and that have its last file modification that exceeds the duration that is precised.

         

        you just have to call such function at every time you run your script.

  • anupamchampati's avatar
    anupamchampati
    Frequent Contributor

    You can get access to the Logs using. Project.Logs.Count with top 1st result will start with 0 & there respective child status Pass and Fail by log.ErrCount for each of them.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Not quite what was being asked...  they are looking for the ability to limit the number of exported logs on drive based upon the option being stored for max number of logs?