Forum Discussion

booradley's avatar
Occasional Contributor
6 years ago

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

  • Marsha_R's avatar
    Champion Level 3

    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.

    • booradley's avatar
      Occasional Contributor

      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.

      • tristaanogre's avatar
        Esteemed Contributor

        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.