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)
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.
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
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.
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.
[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
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.
SmartBear Community and Education Manager