public static string GetRootFolderPath(CoverageSettings coverageSettings) { string rootFolderPath = string.Empty; string coverageFolderPath = string.Empty; if (CommandLineManager.instance.batchmode && !CommandLineManager.instance.useProjectSettings) { if (coverageSettings.resultsPathFromCommandLine.Length > 0) { coverageFolderPath = coverageSettings.resultsPathFromCommandLine; EnsureFolderExists(coverageFolderPath); } } else { if (CommandLineManager.instance.runFromCommandLine && coverageSettings.resultsPathFromCommandLine.Length > 0) { coverageFolderPath = coverageSettings.resultsPathFromCommandLine; EnsureFolderExists(coverageFolderPath); } else { coverageFolderPath = CoveragePreferences.instance.GetStringForPaths("Path", string.Empty); } } string projectPath = GetProjectPath(); if (EnsureFolderExists(coverageFolderPath)) { coverageFolderPath = NormaliseFolderSeparators(coverageFolderPath, true); // Add 'CodeCoverage' directory if coverageFolderPath is projectPath if (string.Equals(coverageFolderPath, projectPath, StringComparison.InvariantCultureIgnoreCase)) { rootFolderPath = JoinPaths(coverageFolderPath, coverageSettings.rootFolderName); } // else user coverageFolderPath as the root folder else { rootFolderPath = coverageFolderPath; } } else { // Add 'CodeCoverage' directory to projectPath if coverageFolderPath is not valid rootFolderPath = JoinPaths(projectPath, coverageSettings.rootFolderName); } return(rootFolderPath); }
public void OnInitialise(CoverageSettings settings) { m_CoverageSettings = settings; if (!m_OutputPerTest && m_CoverageSettings.resetCoverageData) { Coverage.ResetAll(); } m_ReporterFilter.SetupFiltering(); if (m_Writer == null) { m_Writer = new OpenCoverResultWriter(m_CoverageSettings); } m_Writer.SetupCoveragePaths(); }
public static string GetHistoryFolderPath(CoverageSettings coverageSettings) { string historyFolderPath = string.Empty; string rootFolderPath = coverageSettings.rootFolderPath; if (CommandLineManager.instance.batchmode && !CommandLineManager.instance.useProjectSettings) { if (coverageSettings.historyPathFromCommandLine.Length > 0) { historyFolderPath = coverageSettings.historyPathFromCommandLine; EnsureFolderExists(historyFolderPath); } } else { if (CommandLineManager.instance.runFromCommandLine && coverageSettings.historyPathFromCommandLine.Length > 0) { historyFolderPath = coverageSettings.historyPathFromCommandLine; EnsureFolderExists(historyFolderPath); } else { historyFolderPath = CoveragePreferences.instance.GetStringForPaths("HistoryPath", string.Empty); } } bool addHistorySubDir = false; string projectPath = GetProjectPath(); if (EnsureFolderExists(historyFolderPath)) { historyFolderPath = NormaliseFolderSeparators(historyFolderPath, true); // If historyFolderPath == rootFolderPath, add 'Report-history' sub directory in rootFolderPath if (string.Equals(historyFolderPath, rootFolderPath, StringComparison.InvariantCultureIgnoreCase)) { addHistorySubDir = true; } // If historyFolderPath == projectPath, add 'CodeCoverage' directory to projectPath // and add 'Report-history' sub directory in rootFolderPath else if (string.Equals(historyFolderPath, projectPath, StringComparison.InvariantCultureIgnoreCase)) { rootFolderPath = JoinPaths(projectPath, coverageSettings.rootFolderName); addHistorySubDir = true; } // otherwise keep the original historyFolderPath } else { // If historyFolderPath is not valid, add 'CodeCoverage' directory to projectPath // and add 'Report-history' sub directory in rootFolderPath rootFolderPath = JoinPaths(projectPath, coverageSettings.rootFolderName); addHistorySubDir = true; } if (addHistorySubDir) { historyFolderPath = JoinPaths(rootFolderPath, CoverageSettings.ReportHistoryFolderName); } return(historyFolderPath); }
public OpenCoverResultWriter(CoverageSettings coverageSettings) : base(coverageSettings) { }