cancel
Showing results for 
Search instead for 
Did you mean: 

Log.SaveResultsAs() does not give a value for "error test count" field

Highlighted
Occasional Contributor

Log.SaveResultsAs() does not give a value for "error test count" field

I am trying to get some information from the logs after my final test has completed but when I call Log.SaveResultsAs() from code some of the fields in description.tclog are not filled in.  "error test count" and "warning test count" are always 0.

 

I have an event handler for OnStopTest() where I call Log.SaveResultsAs(tempFolder, lsXML) from the final test.  Even though all of the tests have been executed, "error test count" and "warning test count" are always 0.  I tried calling Log.SaveToDisk() right before I call Log.SaveResultsAs() hoping that it would flush the buffer but I am still seeing some of the values in description.tclog set to 0.

 

Any ideas on how I can get the log file generated with the updated values (including "error test count") from my scripts?

 

I don't want to have to add another project, I would prefer to do this from the OnStopTest() event handler (I do check that the log is only written for the final test)

4 REPLIES 4
Community Hero

Re: Log.SaveResultsAs() does not give current information

Do you know for sure that error test count and warning test count are non-zero inside your test?  I would look at that first.

Occasional Contributor

Re: Log.SaveResultsAs() does not give current information

Yes, I verified that several of the tests that ran before I dumped the logs have errors.  Interestingly, the "error count" field is > 0 but "error test count" = 0.

 

When the program stops, the log file that is created shows the correct error test count even though no new tests have been run.  Unfortunately, I really need to get the error test count while the program is running.  I was hoping to get this from the OnStopTest event handler.

Community Hero

Re: Log.SaveResultsAs() does not give current information

Here's my guess... and I'm not certain about this... but I'd be willing to bet that those counters aren't flushed to disk until the very last steps of a test run.  They are probably kept in memory until then to be sure that any last minute errors and/or warnings are tabulated.

 

I would suggest you contact SmartBear support directly to confirm this.  


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
Community Manager

Re: Log.SaveResultsAs() does not give current information

Hi @booradley,

 

Have you contacted the Support Team? What was their suggestion?

 

Also, could you please make sure that you export the log after the error? We have tried exporting the log to the XML file, and it contains the correct number of errors.

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

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Top Kudoed Authors