cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
Frequent Contributor

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

Hi everyone,

 

I was wondering if there is a way I can export log files for project test items separately?. I would like to keep a copy of the logs for the test that passed when doing regression, but it is not always so lucky that all tests can pass at once. The Log.SaveResultsAs methods exports the log files for the entire project, but I would like to export log files for project test items separately one by one, is there anyway to do that?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
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
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available

View solution in original post

15 REPLIES 15
Highlighted
Frequent Contributor

Re: How can I export multiple log items at once

Anyone knows whether this is doable?

Highlighted
Community Hero

Re: How can I export multiple log items at once

Sorry, this is not doable.  Each log is exported individually.  So, you can't select multiples and export them all at once.


Robert Martin
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available
Highlighted
Community Manager

Re: How can I export multiple log items at once

Hi @whuang,

 

I wonder why you need to export several log items at the same time. Could you please describe your use case? Perhaps, we can suggest an alternative solution.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Frequent Contributor

Re: How can I export multiple log items at once

Hi @TanyaGorbunova I usually run one or several project suites at once, which may contain dozens to hundred test cases, and not all of the them can pass together, and I would like to keep a copy of the passed test logs as a reference. For the failed tests, I will pick them out, fix them, and run them seperately, so I don't need to spend time on running the passed test again just for getting a perfect test log. So if in a project suite of 40 test, I had 20 test cases passed, 20 failed, I will hve to export the logs 20 times to get them all.

Highlighted
Community Hero

Re: How can I export multiple log items at once

Are you aware of being able to export the logs in code so that, at the end of each project, you simply export the log for that project?  That way you don't need to right-click/export manually.  Perhaps that is the better solution for you.


Robert Martin
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available
Highlighted
Frequent Contributor

Re: How can I export multiple log items at once

Thanks @tristaanogre , that I didn't know. Can you please provide the page link where explains how that works?

Highlighted
Frequent Contributor

Re: How can I export multiple log items at once

Nevermind, I think I found it, is it "Call Log.SaveResultsAs"?

Highlighted
Community Hero

Re: How can I export multiple log items at once

That's the method. Give that a try and see if that solves your issue.


Robert Martin
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available
Highlighted
Frequent Contributor

Re: How can I export multiple log items at once

Hi @tristaanogre I tried both "Call Log.SaveResultsAs("C:\Users\whuang\Downloads\try", lsMHT)" and "Call Log.SaveResultsAs("C:\Users\whuang\Downloads\try", 2)", they both gave me a file with name "try" without extension. I don't see anything wrong in the command.

 

Also, because I will do the Log.SaveResultsAs as the very last step for a passed test, is there any way to check whether there is any error or warning occured in the previous steps of the test?

 

Thanks!

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors