You need to make sure that the file name you present in the method has the extension. It won't automatically add the extension. So "Call Log.SaveResultsAs("C:\Users\whuang\Downloads\try.mht", lsMHT)"
For detecting if there is an error, Log.ErrCount (https://support.smartbear.com/testcomplete/docs/reference/project-objects/test-log/log/errcount.html) gives you the count of error records written to the log. So, just do a check if ErrCount > 0 for anything you want to do for errors.
Thanks @tristaanogre that's exactly what I wanted.
Hi @tristaanogre I just noticed Log.SaveResultsAs exports all the log files for entire project/test set. Is there any way I can export log files for each test item in a test set separately? Say I have a test project of 3 tests, after executing each test item, export the log file for that test item only, I don't need 3 copies of the first test item.
Check out the "scope" parameter.
Yes, I did used "lesCurrentTestItem" for the scope in the method, but it still gave me the log files for the entire test set. Here is what I did, I called Log.SaveResultsAs(FileName, lsMHT, True, lesCurrentTestItem) method at the very last step of every single of my test, and I have a test set that has list of tests. So when I ran the test set, it exported me a log file for the first test item when the execution for the first one is done, this is what I want - a log file for the current running test item. but when it finished executing the second test item, it exported me a log file that had both the first and the second test item, this is not what I need, I only want the log file for the second test item, I already had the log file for the first test item, I don't want it again.
If there is no TC buildin funtion to export log files for project test items separately, is there anyway I can automate the manual export work? like writing a bat file? Any suggestion?
Thanks in advance!