Exemplo n.º 1
0
        public static int GenerateReport(string rootFolderPath, string outputFolderPath, string[] exclusionDirs, MainForm mainForm)
        {
            // Clear the lists/dictionaries of files and requirement IDs in case we need to generate the reports again.
            requirementDocuments.Clear();
            reqCodeLookup.Clear();
            reqDocCount.Clear();
            sourceCodeFiles.Clear();
            repeatingRequirements.Clear();
            invalidRequirements.Clear();
            reqDocLookup.Clear();
            reqCodeMatrix.Clear();
            reqTestMatrix.Clear();
            missingCodeCoverage.Clear();
            missingTestCoverage.Clear();

            int result = 0;

            // disable GUI elements if the program was called from command line interface.
            if (mainForm == null)
            {
                useGUI = false;
            }

            // output dir is an empty string if not valid.
            bool useOutputDir = (outputFolderPath.Length != 0);

            // Read requirement identifiers and file paths from word documents and source code files.
            GetRequirementsFromDocuments(rootFolderPath, exclusionDirs);

            // Update status on the progress bar
            if (mainForm != null)
            {
                mainForm.UpdateStatus(25);
            }

            GetRequirementsFromSource(rootFolderPath, exclusionDirs);

            // Update status on the progress bar
            if (mainForm != null)
            {
                mainForm.UpdateStatus(50);
            }

            GenerateTraceabilityMatrix();

            // Update status on the progress bar
            if (mainForm != null)
            {
                mainForm.UpdateStatus(75);
            }

            FindUncoveredRequirements();

            // Write all reports to plain text files
            if (MainForm.outputText && useOutputDir)
            {
                ReportWriter.WriteTraceabilityReport(outputFolderPath);
                ReportWriter.WriteInvalidReqReport(outputFolderPath);
                ReportWriter.WriteMissingCodeCoverageReport(outputFolderPath);
                ReportWriter.WriteMissingTestCoverageReport(outputFolderPath);
                ReportWriter.WriteMissingCodeAndTestCoverageReport(outputFolderPath);
                ReportWriter.WriteRepeatingReqReport(outputFolderPath);
            }

            // Write all reports to CSV files
            if (MainForm.outputCSV && useOutputDir)
            {
                CSVReportWriter.WriteTraceabilityReport(outputFolderPath);
                CSVReportWriter.WriteMissingReqReport(outputFolderPath);
                CSVReportWriter.WriteRepeatingReqReport(outputFolderPath);
            }

            if (MainForm.buildCheck)
            {
                result = ConsoleReportWriter.WriteMissingReqReport();
            }

            // Update status on the progress bar
            if (mainForm != null)
            {
                mainForm.UpdateStatus(100);
            }

            return(result);
        }
Exemplo n.º 2
0
        public static void GenerateReport(string rootFolderPath, string outputFolderPath, MainForm mainForm)
        {
            // Clear the lists/dictionaries of files and requirement IDs in case we need to generate the reports again.
            requirementDocuments.Clear();
            reqCodeLookup.Clear();
            sourceCodeFiles.Clear();
            repeatingRequirements.Clear();
            invalidRequirements.Clear();
            reqDocLookup.Clear();
            reqCodeMatrix.Clear();
            reqTestMatrix.Clear();
            missingCodeCoverage.Clear();
            missingTestCoverage.Clear();

            // disable GUI elements if the program was called from command line interface.
            if (mainForm == null)
            {
                useGUI = false;
            }

            // Read requirement identifiers and file paths from word documents and source code files.
            GetRequirementsFromDocuments(rootFolderPath);

            // Update status on the progress bar
            if (mainForm != null)
            {
                mainForm.UpdateStatus(25);
            }

            GetRequirementsFromSource(rootFolderPath);

            // Update status on the progress bar
            if (mainForm != null)
            {
                mainForm.UpdateStatus(50);
            }

            GenerateTraceabilityMatrix();

            // Update status on the progress bar
            if (mainForm != null)
            {
                mainForm.UpdateStatus(75);
            }

            FindUncoveredRequirements();

            // Write all reports to plain text files
            if (MainForm.outputText)
            {
                ReportWriter.WriteTraceabilityReport(outputFolderPath);
                ReportWriter.WriteInvalidReqReport(outputFolderPath);
                ReportWriter.WriteMissingCodeCoverageReport(outputFolderPath);
                ReportWriter.WriteMissingTestCoverageReport(outputFolderPath);
                ReportWriter.WriteMissingCodeAndTestCoverageReport(outputFolderPath);
                ReportWriter.WriteRepeatingReqReport(outputFolderPath);
            }

            // Write all reports to CSV files
            if (MainForm.outputCSV)
            {
                CSVReportWriter.WriteTraceabilityReport(outputFolderPath);
                CSVReportWriter.WriteMissingReqReport(outputFolderPath);
                CSVReportWriter.WriteRepeatingReqReport(outputFolderPath);
            }

            // Update status on the progress bar
            if (mainForm != null)
            {
                mainForm.UpdateStatus(100);
            }
        }