Forum Discussion
tristaanogre
14 years agoEsteemed Contributor
1) There is an auto-save feature of the log file that, every so many minutes, it is saved to disk. Now, if your PC crashes, that saved log won't be linked to the project, but it is not "lost". Using Allen's suggestion, you can navigate to the default log location for your project and re-add it into your project for evaluation.
2) You can also use an "OnStopTest" event handler to write your log file out when a test item is completed or, even, write it out OnLogError or OnLogWarning. This will allow you to dump your log out for particular problems to allow you to recapture that state at some point in time.
3) You might want to consider reducing how much is in the content of your log file. Are all the messages strictly necessary? All the screenshots? Etc. Do you really need to know each time the test goes to a particular form and writes something out... or do you only need to know when it fails? These are just a couple of questions I consistently ask myself when building a project for this exact reason. Log files can get unwieldy if too much unnecessary "noise" is logged to them. I'm not saying you don't have some necessary logging, but it may be that you can reduce some of the "noise" to only those essential things you need for a regular run.
4) My solutions for 1 and 3 may be helpful to make your efforts for 4 unnecessary. However, the use of Log.SaveResultsAs may be helpful in your solution for #4 as you can name the log files as you want them to be named by passing in values and such to give the files a unique name. MHT is only one of the methods you can use. If you use the XML format, I THINK (but I'm not sure) that this is the "raw" format that is generated by default by TestComplete that you can then re-add back to a project.
Hopefully my suggestions can give you some direction to be better able to manage your logs.
2) You can also use an "OnStopTest" event handler to write your log file out when a test item is completed or, even, write it out OnLogError or OnLogWarning. This will allow you to dump your log out for particular problems to allow you to recapture that state at some point in time.
3) You might want to consider reducing how much is in the content of your log file. Are all the messages strictly necessary? All the screenshots? Etc. Do you really need to know each time the test goes to a particular form and writes something out... or do you only need to know when it fails? These are just a couple of questions I consistently ask myself when building a project for this exact reason. Log files can get unwieldy if too much unnecessary "noise" is logged to them. I'm not saying you don't have some necessary logging, but it may be that you can reduce some of the "noise" to only those essential things you need for a regular run.
4) My solutions for 1 and 3 may be helpful to make your efforts for 4 unnecessary. However, the use of Log.SaveResultsAs may be helpful in your solution for #4 as you can name the log files as you want them to be named by passing in values and such to give the files a unique name. MHT is only one of the methods you can use. If you use the XML format, I THINK (but I'm not sure) that this is the "raw" format that is generated by default by TestComplete that you can then re-add back to a project.
Hopefully my suggestions can give you some direction to be better able to manage your logs.
Related Content
- 12 years ago
Recent Discussions
- 27 days ago
- 5 days ago
- 5 days ago
- 8 days ago