Forum Discussion

Kamal_chennai's avatar
Kamal_chennai
Contributor
7 years ago

How to Clear Logs from ProjectSuite without opening testcomplete

Hi Team,

 

Happy to see you all after long time :) .

 

After test ends I am importing Test log into one path like "C:\Users\kamal\TestProject\FinalResult.mht".

 

Now I want to Remove/Delete the complete log file from ProjectSuite. Also if i delete log from projectsuite,  it should delete some dump folder which contains all the event images (C:\Users\kamal\TestProject\Project1\Log\3_21_2018_7_51 PM_22_742).

 

Is there any Methode to do it using VBscript?

 

Thanks,

Kamal

 

 

 

9 Replies

  • It's not just as simple as deleting some files.  You'd also have to modify a couple of the project files, which are not the easiest things to modify by hand or by code if you don't understand the schema.  And you'd have to do it after your project suite completes it's run, because TestComplete keeps those files open during the run.

     

    In short, like tristaanogre said, no.

    • HarnekSandhu's avatar
      HarnekSandhu
      Occasional Contributor

      As shown by earlier replies, it is not easy to do that while the project is running.

       

      I have a particular way of doing log (and visualizer) clean up after I have run a batch of tests overnight and happy to clean up for the next run. Hopefully this gives you an option.

       

      1. Use a search app to find the Log and Visualizer folders. I use FileLocater (Lite version also available free) and use the following search regular pattern on the tests directory:  ^Visualizer$|^Log$

       

      2. Highlight the search results and hit DEL - done.

       

      Hope that helps.

       

      Harnek

      • will_fetherolf's avatar
        will_fetherolf
        Contributor

        Sure, you CAN do that.  I wouldn't recommend it. 

         

        When you open your project, TestComplete will attempt to index the log files so it can access them a little quicker when you want.  Because you've deleted the files, TestComplete will complain because the files are not accessible.  If you see this as acceptable behaviour, feel free to do so.  Personally, when I open a project I was to start working on it as quickly as possible and I don't want to be distracted by some dialog begging for my attention. YMMV.

  • cunderw's avatar
    cunderw
    Community Hero

    Your best option would be to use some sort of source control that has your master set to an instance of the project with no logs in it (in fact I would use the source control ignore to ignore anything log related), then after a test run, just do a revert / cleanup. 

     

    We use git, and this is what our .gitignore looks like:

     

    *.bak
    *.tcCfgExtender
    *.tcLS*
    Visualizer/
    Log/
    *.tcax.tlb

     

    We also save all of the logs during run time outside of the project folder and in a shared log folder. Doing all of these ensure that during test execution (not development) you have a clean environment. 

  • Sure, I can do that.

     

    I merely deleted a dated directory from the Log directory of one of my projects. 

     

    If you're deleting the entire Log directory, that may be why you're not seeing this dialog. The file {projectfilename}.tcLogs or {projectsuitefilename}.tcLogs contains the mapping for the directories, and if you delete the entire Logs directory TestComplete will create the Log directory structure and that file when it starts.

     

     

     

    • HarnekSandhu's avatar
      HarnekSandhu
      Occasional Contributor

      Which is why I recommended total Log and Visualizer folder removal. I, like the OP, also save my logs via script, to a central location so it makes sense to do a full clean-up before the next test cycle starts.

       

      That is why TC won't generate warning dialog and I don't recommend individual log deletion from the Log folder.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Let me modify... using aqFile and aqFileSystem, you can actually delete the files and folders... but I honestly wouldn't recommend it because some of the files that point to the log files themselves are in use.