Example #1
0
        // false if no tests found.
        private static bool PostProcessTests(CommandLineArguments args, string outputDir)
        {
            //////////////////////////////////////////////////////////////////////
            // Determine directory where generated tests were written.

            DirectoryInfo resultsDir = new DirectoryInfo(outputDir);

            //////////////////////////////////////////////////////////////////////
            // Collect all tests generated.

            Collection <FileInfo> tests = TestCaseUtils.CollectFilesEndingWith(".cs", resultsDir);

            if (tests.Count == 0)
            {
                return(false);
            }

            Dictionary <TestCase.ExceptionDescription, Collection <FileInfo> > classifiedTests =
                TestCaseUtils.ClassifyTestsByMessage(tests);

            PrintStats(classifiedTests);

            //////////////////////////////////////////////////////////////////////
            // Create stats file.

            StatsManager.ComputeStats(resultsDir + "\\allstats.txt",
                                      TestCaseUtils.CollectFilesEndingWith(".stats.txt", resultsDir));

            //////////////////////////////////////////////////////////////////////
            // Create HTML index.

            //HtmlSummary.CreateIndexHtml(classifiedTests, resultsDir + "\\index.html", args.ToString());
            HtmlSummary.CreateIndexHtml2(classifiedTests, resultsDir + "\\index.html", args.ToString());

            Console.WriteLine();
            Console.WriteLine("Results written to " + resultsDir + ".");
            Console.WriteLine("You can browse the results by opening the file "
                              + System.Environment.NewLine
                              + "   " + resultsDir + "\\index.html");

            return(true);
        }