cancel
Showing results for 
Search instead for 
Did you mean: 

How can I export log files for project test items separately?

Community Hero

Re: How can I export multiple log items at once

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Highlighted
Contributor

Re: How can I export multiple log items at once

Thanks @tristaanogre that's exactly what I wanted.

Contributor

Re: How can I export multiple log items at once

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.

Community Hero

Re: How can I export multiple log items at once

Check out the "scope" parameter.

 

https://support.smartbear.com/testcomplete/docs/reference/project-objects/test-log/log/saveresultsas...


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: How can I export multiple log items at once

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.

Contributor

Re: How can I export multiple log items at once

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!

New Here?
Join us and watch the welcome video:
Join the September Hub-bub to show off, learn and win