Code: Select all
TestReport.Setup(ReportLevel.Info, "filename.xml", true); TestReport.ReportWriteInterval = 0; TestReport.BeginTestSuite("TestSuite"); TestReport.BeginTestCase("TestCase"); TestReport.BeginTestModule("TestModule"); if (//testmodule succeeded) Report.Success("success"); else Report.Failure("failed"); TestReport.EndTestModule(); if (//TestCase succeeded) Report.Success("success") else Report.Failure("failed"); TestReport.EndTestTestCase(); TestReport.SaveReport();
This works pretty well the first time around. But if I run in again, it saves the report from the previous run, i.e. if the first time the test succeeded, I make it fail the second time, but the report still shows success. Then if I quit the exe and re-run the test, making it fail, it will show the correct report. But again, if I run the test again, this time successfully, the report will still show failure.
I was thinking that maybe there's something like EndTestSuite() command to reset the report, but there's none... What can I do here? TestReport object is static, so I can't get rid of it and create a new one...