private void LoadPreviousResult() { if (!this.Arguments.UseLatestHistory) { return; } if (!System.IO.Directory.Exists(this.Arguments.ReportOutputPath)) { return; } do { string latestResultFile = new ReportHistory( this.Arguments.ReportOutputPath, this.BatchFactory.MainAssembly).GetLatestXmlReport(); if (latestResultFile != null) { this.TestListeners.Message( MessageImportance.Low, "Found previous report: {0}", latestResultFile); System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegions(); try { this.report.TestListener.SetPreviousTestBatch(latestResultFile); this.TestListeners.Message( MessageImportance.Low, "Loaded {0} fixtures and {1} tests in previous report", this.report.TestListener.TestBatchSearcher.Fixtures.Count, this.report.TestListener.TestBatchSearcher.TestCases.Count); break; } catch (Exception ex) { this.TestListeners.Warning("Failure while loading previous report"); this.TestListeners.Message( MessageImportance.Low, "Error: {0}", ex.Message); // deleting previous report ReportCleaner cleaner = new ReportCleaner(this.BatchFactory.MainAssembly); cleaner.Clean(Path.GetDirectoryName(latestResultFile), this); } } else { this.TestListeners.Message( MessageImportance.Low, "Could not find previous result"); break; } } while (true); }
private void CleanOldReports() { if (!this.Arguments.CleanOldReports) { return; } this.TestListeners.Message( MessageImportance.Low, "Cleaning old reports"); ReportCleaner cleaner = new ReportCleaner(this.BatchFactory.MainAssembly); cleaner.MaxReportCount = this.Arguments.MaxReportCount; cleaner.Clean(this.Arguments.ReportOutputPath, this); }