コード例 #1
0
        internal static void WriteSummaryReport(XmlTableWriter tableWriter, TestRecords tests)
        {
            //
            Dictionary <string, MachineSummaryEntry> SummaryTable = ProduceMachineSummaries(tests);

            tableWriter.WriteStartElement("Summary");
            foreach (MachineSummaryEntry entry in SummaryTable.Values)
            {
                tableWriter.WriteStartElement("MachineSummary");
                tableWriter.WriteAttributeString("MachineName", entry.Name);
                tableWriter.WriteAttributeString("FailingVariations", entry.FailedVariations.ToString(CultureInfo.InvariantCulture));
                tableWriter.WriteAttributeString("TotalVariations", (entry.TotalVariations).ToString(CultureInfo.InvariantCulture));
                tableWriter.WriteAttributeString("TestsWithoutVariation", (entry.TestsWithoutVariation).ToString(CultureInfo.InvariantCulture));
                float passRate         = 0;
                float adjustedPassRate = 0;
                if (entry.TotalVariations > 0)
                {
                    passRate = (((entry.TotalVariations - entry.FailedVariations) / (float)entry.TotalVariations) * 100);
                    //Failures on tests with known bugs can be treated as passing, but we make clear this is not the actual pass rate.
                    adjustedPassRate = (((entry.TotalVariations - entry.FailedVariations + entry.FailedVariationsWithBugs) / (float)entry.TotalVariations) * 100);
                }
                tableWriter.WriteAttributeString("PassRate", passRate.ToString("0.00", CultureInfo.InvariantCulture));
                tableWriter.WriteAttributeString("AdjustedPassRate", adjustedPassRate.ToString("0.00", CultureInfo.InvariantCulture));
                tableWriter.WriteAttributeString("TestExecutionTime", ReportingUtilities.FormatTimeSpanAsHms(entry.TestExecutionTime));

                tableWriter.WriteEndElement();
            }
            tableWriter.WriteEndElement();
        }
コード例 #2
0
        private static void Generate(Dictionary <string, TestCollection> testCollectionDictionary, string areaReportsPath, string area)
        {
            string filenameSuffix = "VariationReport.xml";

            using (XmlTableWriter tableWriter = new XmlTableWriter(Path.Combine(areaReportsPath, area + filenameSuffix)))
            {
                tableWriter.AddXsl(@"..\VariationReport.xsl");
                tableWriter.WriteStartElement("Variations");

                int testIndex = 0;
                foreach (string subarea in testCollectionDictionary.Keys)
                {
                    TestCollection testsInSubarea = testCollectionDictionary[subarea] as TestCollection;
                    tableWriter.WriteStartElement("SubArea");
                    tableWriter.WriteAttributeString("SubArea", subarea);
                    foreach (TestRecord test in testsInSubarea)
                    {
                        testIndex++;
                        WriteTestNode(tableWriter, areaReportsPath, area, test, testIndex);
                    }

                    tableWriter.WriteEndElement();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Write a Test node under Test, to hold information for the Test: log, test result, duration, Test info, which
        /// won't show for every Variation in Xml viewer.
        /// </summary>
        /// <param name="tableWriter">Writer</param>
        /// <param name="test">test</param>
        /// <param name="testInfo">testInfo</param>
        /// <param name="testLogPath">test log path</param>
        private static void WriteChildTestNode(XmlTableWriter tableWriter, TestRecord test, TestInfo testInfo, string testLogPath)
        {
            bool logTruncated = false;

            tableWriter.WriteStartElement("Test");
            tableWriter.WriteAttributeString("Duration", ReportingUtilities.FormatTimeSpanAsSeconds(ReportingUtilities.GetTestDuration(test))); //Total test execution Time
            tableWriter.WriteAttributeString("Result", ReportingUtilities.InterpretTestOutcome(test).ToString());
            tableWriter.WriteAttributeString("Log", ReportingUtilities.ProcessLongLog(test.Log, testLogPath, ref logTruncated));
            if (logTruncated)
            {
                tableWriter.WriteAttributeString("LogPath", Path.Combine(ReportingUtilities.TestLogsDir, Path.GetFileName(testLogPath)));
            }
            tableWriter.WriteAttributeString("LogDir", ReportingUtilities.ReportPaths(test.LoggedFiles));

            int  failed      = 0;
            int  failedOnBug = 0;
            bool hasBugs     = ReportingUtilities.TestHasBugs(testInfo);

            foreach (VariationRecord variation in test.Variations)
            {
                failed      += ReportingUtilities.OneForFail(variation.Result);
                failedOnBug += ReportingUtilities.OneForFailOnBug(variation.Result, hasBugs);
            }
            tableWriter.WriteAttributeString("Failures", string.Format("{0}", failed - failedOnBug));
            tableWriter.WriteAttributeString("Total", string.Format("{0}", test.Variations.Count));
            tableWriter.WriteEndElement();
        }
コード例 #4
0
 internal static void Generate(TestRecords tests, DirectoryInfo ReportRoot)
 {
     using (XmlTableWriter tableWriter = new XmlTableWriter(Path.Combine(ReportRoot.FullName, "MachineSummary.xml")))
     {
         tableWriter.AddXsl("MachineSummary.xsl");
         WriteSummaryReport(tableWriter, tests);
     }
 }
コード例 #5
0
ファイル: LabReportGenerator.cs プロジェクト: dotnet/wpf-test
 private static void AppendPaths(XmlTableWriter tableWriter, RunInfo runInfo, DirectoryInfo reportRoot)
 {
     tableWriter.WriteStartElement("Paths");
     tableWriter.WriteKeyValuePair("Results", reportRoot.FullName);
     tableWriter.WriteKeyValuePair("Build Location:", runInfo.InstallerPath);
     tableWriter.WriteKeyValuePair("Test Build Path", runInfo.TestBinariesPath);
     tableWriter.WriteEndElement();
 }
コード例 #6
0
        private static void WriteVariationNode(XmlTableWriter tableWriter, VariationRecord variation, string variationLogPath)
        {
            bool logTruncated = false;

            tableWriter.WriteStartElement("Variation");
            tableWriter.WriteAttributeString("Variation", variation.VariationName);
            tableWriter.WriteAttributeString("VariationId", variation.VariationId.ToString(CultureInfo.InvariantCulture));
            tableWriter.WriteAttributeString("Duration", ReportingUtilities.FormatTimeSpanAsSeconds(ReportingUtilities.GetVariationDuration(variation)));
            tableWriter.WriteAttributeString("Result", variation.Result.ToString());
            tableWriter.WriteAttributeString("Log", ReportingUtilities.ProcessLongLog(variation.Log, variationLogPath, ref logTruncated));
            if (logTruncated)
            {
                tableWriter.WriteAttributeString("LogPath", Path.Combine(ReportingUtilities.TestLogsDir, Path.GetFileName(variationLogPath)));
            }
            tableWriter.WriteAttributeString("LogDir", ReportingUtilities.ReportPaths(variation.LoggedFiles));
            tableWriter.WriteEndElement();
        }
コード例 #7
0
 private static void Generate(TestRecords Records, string path)
 {
     using (XmlTableWriter tableWriter = new XmlTableWriter(path))
     {
         tableWriter.AddXsl(@"FilteringReport.xsl");
         tableWriter.WriteStartElement("Tests");
         foreach (TestRecord test in Records.TestCollection)
         {
             TestInfo testInfo = test.TestInfo;
             {
                 tableWriter.WriteStartElement("Test");
                 tableWriter.WriteAttributeString("Area", testInfo.Area);
                 tableWriter.WriteAttributeString("SubArea", testInfo.SubArea);
                 tableWriter.WriteAttributeString("TestName", testInfo.Name);
                 tableWriter.WriteAttributeString("Explanation", test.FilteringExplanation);
                 tableWriter.WriteEndElement();
             }
         }
         tableWriter.WriteEndElement();
     }
 }
コード例 #8
0
        /// <summary>
        ///  Write one test.
        /// </summary>
        /// <param name="tableWriter">Writer</param>
        /// <param name="areaReportsPath">Area path</param>
        /// <param name="area">Area name</param>
        /// <param name="test">TestRecord</param>
        /// <param name="testIndex">Index of the test</param>
        private static void WriteTestNode(XmlTableWriter tableWriter, string areaReportsPath, string area, TestRecord test, int testIndex)
        {
            TestInfo testInfo = test.TestInfo;

            string testLogsDirectory  = Path.Combine(areaReportsPath, ReportingUtilities.TestLogsDir);
            string testInfosDirectory = Path.Combine(areaReportsPath, ReportingUtilities.TestInfosDir);

            //Test Layer with attribute needed for all variation.
            tableWriter.WriteStartElement("Test");
            tableWriter.WriteAttributeString("Name", Escape(testInfo.Name));
            tableWriter.WriteAttributeString("KnownBugs", test.TestInfo.Bugs.ToCommaSeparatedList());
            tableWriter.WriteAttributeString("Priority", test.TestInfo.Priority.ToString());
            tableWriter.WriteAttributeString("Machine", ReportingUtilities.ReportMachine(test.Machine));

            string testInfoPath = Path.Combine(testInfosDirectory, String.Format("{0}_{1}.xml", area, testIndex));

            if (ReportingUtilities.InterpretTestOutcome(test) == Result.Fail)
            {
                ReportingUtilities.SaveTestInfo(testInfoPath, testInfo);
                tableWriter.WriteAttributeString("TestInfo", Path.Combine(ReportingUtilities.TestInfosDir, Path.GetFileName(testInfoPath)));
            }

            for (int variationIndex = 0; variationIndex < test.Variations.Count; variationIndex++)
            {
                VariationRecord variation = test.Variations[variationIndex];

                string variationLogPath = Path.Combine(testLogsDirectory, String.Format("{0}_{1}_{2}.log", area, testIndex, variationIndex));
                WriteVariationNode(tableWriter, variation, variationLogPath);
            }

            //SEMI HACK: Create a node to hold information for test, that are not needed for most variation.
            // This solves three problems:
            //           1 - Allows us to provide Test level information in tabular form
            //           2 - Allows us to include Test level execution logs in these reports
            // Note - To nest these things attribute in parent Test node, while less hacky, would create a different semantic from the perspective of any XML viewer, which would be bad. very bad.
            string testLogPath = Path.Combine(testLogsDirectory, String.Format("{0}_{1}.log", area, testIndex));

            WriteChildTestNode(tableWriter, test, testInfo, testLogPath);
            tableWriter.WriteEndElement();
        }
コード例 #9
0
ファイル: LabReportGenerator.cs プロジェクト: dotnet/wpf-test
        private static void AppendConfigurations(XmlTableWriter tableWriter, RunInfo runInfo)
        {
            tableWriter.WriteStartElement("Configurations");

            tableWriter.WriteKeyValuePair("Run ID", runInfo.Id);
            tableWriter.WriteKeyValuePair("Build", runInfo.Build);
            tableWriter.WriteKeyValuePair("Branch", runInfo.Branch);
            tableWriter.WriteKeyValuePair("Platform", runInfo.OS);
            tableWriter.WriteKeyValuePair("Language", runInfo.Language);
            tableWriter.WriteKeyValuePair("Priorities", runInfo.Priority);
            tableWriter.WriteKeyValuePair("Run Type", runInfo.RunType);
            tableWriter.WriteKeyValuePair("Date", runInfo.Date);
            tableWriter.WriteKeyValuePair("Architecture", runInfo.Architecture);
            tableWriter.WriteKeyValuePair("IE Version", runInfo.IEVersion);
            tableWriter.WriteKeyValuePair("DPI", runInfo.Dpi);
            tableWriter.WriteKeyValuePair("Versions", runInfo.Version);
            tableWriter.WriteKeyValuePair("Code Coverage", runInfo.IsCodeCoverage);
            tableWriter.WriteKeyValuePair("AppVerify", runInfo.IsAppVerify);
            tableWriter.WriteKeyValuePair("Name", runInfo.Name);

            tableWriter.WriteEndElement();
        }
コード例 #10
0
ファイル: LabReportGenerator.cs プロジェクト: dotnet/wpf-test
        internal static void Generate(TestRecords tests, RunInfo runInfo, DirectoryInfo reportRoot)
        {
            using (XmlTableWriter tableWriter = new XmlTableWriter(Path.Combine(reportRoot.FullName, "LabReport.xml")))
            {
                tableWriter.AddXsl("LabReport.xsl");
                tableWriter.WriteStartElement("LabReport");

                string reportPath = reportRoot.FullName;
                if (reportPath.EndsWith(@"\"))
                {
                    // Remove the final slashy to prevent malformed XML since all XSLs expect non-slash end.
                    reportPath = reportPath.Remove(reportPath.Length - 1);
                }
                tableWriter.WriteAttributeString("ReportPath", reportPath);

                SummaryReportGenerator.WriteSummaryReport(tableWriter, tests);
                AppendNotes(tableWriter, runInfo);
                AppendConfigurations(tableWriter, runInfo);
                AppendPaths(tableWriter, runInfo, reportRoot);
                tableWriter.WriteEndElement();
            }
        }
コード例 #11
0
ファイル: DrtReportGenerator.cs プロジェクト: dotnet/wpf-test
        private static void Generate(TestRecords records, string path)
        {
            using (XmlTableWriter tableWriter = new XmlTableWriter(path))
            {
                tableWriter.AddXsl(@"DrtReport.xsl");
                tableWriter.WriteStartElement("Variations");
                tableWriter.WriteAttributeString("PassRate", ReportingUtilities.CalculatePassRate(records));
                foreach (TestRecord test in FilterNonPassingTests(records))
                {
                    TestInfo testInfo = test.TestInfo;
                    {
                        tableWriter.WriteStartElement("Variation");
                        tableWriter.WriteAttributeString("Area", testInfo.Area);
                        tableWriter.WriteAttributeString("TestName", testInfo.Name);
                        tableWriter.WriteAttributeString("Variation", "Test Level Summary");
                        tableWriter.WriteAttributeString("Duration", ReportingUtilities.FormatTimeSpanAsSeconds(ReportingUtilities.GetTestDuration(test))); //Total test execution Time
                        tableWriter.WriteAttributeString("Result", ReportingUtilities.InterpretTestOutcome(test).ToString());
                        tableWriter.WriteAttributeString("Log", test.Log);
                        tableWriter.WriteAttributeString("LogDir", ReportingUtilities.ReportPaths(test.LoggedFiles));
                        tableWriter.WriteEndElement();
                    }

                    foreach (VariationRecord variation in test.Variations)
                    {
                        tableWriter.WriteStartElement("Variation");
                        tableWriter.WriteAttributeString("Area", testInfo.Area);
                        tableWriter.WriteAttributeString("TestName", testInfo.Name);
                        tableWriter.WriteAttributeString("Variation", variation.VariationName);
                        tableWriter.WriteAttributeString("Duration", ReportingUtilities.FormatTimeSpanAsSeconds(ReportingUtilities.GetVariationDuration(variation)));
                        tableWriter.WriteAttributeString("Result", variation.Result.ToString());
                        tableWriter.WriteAttributeString("Log", variation.Log);
                        tableWriter.WriteAttributeString("LogDir", ReportingUtilities.ReportPaths(variation.LoggedFiles));
                        tableWriter.WriteEndElement();
                    }
                }
                tableWriter.WriteEndElement();
            }
        }
コード例 #12
0
        internal static void Generate(TestRecords results, DirectoryInfo ReportRoot)
        {
            string path = Path.Combine(ReportRoot.FullName, "InfraTrackingReport.xml");

            using (XmlTableWriter tableWriter = new XmlTableWriter(path))
            {
                tableWriter.AddXsl("InfraTrackingReport.xsl");
                tableWriter.WriteStartElement("TestFeatureUsage");
                foreach (TestRecord test in results.TestCollection)
                {
                    TestInfo testInfo = test.TestInfo;
                    tableWriter.WriteStartElement("Test");
                    tableWriter.WriteAttributeString("Area", testInfo.Area + " " + testInfo.SubArea);
                    tableWriter.WriteAttributeString("Test", testInfo.Name);

                    if (testInfo.Bugs != null)
                    {
                        tableWriter.WriteAttributeString("Bugs", testInfo.Bugs.ToCommaSeparatedList());
                    }
                    if (testInfo.Configurations != null)
                    {
                        tableWriter.WriteAttributeString("Configurations", testInfo.Configurations.ToCommaSeparatedList());
                    }
                    if (testInfo.Deployments != null)
                    {
                        tableWriter.WriteAttributeString("Deployments", testInfo.Deployments.ToCommaSeparatedList());
                    }
                    if (testInfo.ExecutionGroup != null)
                    {
                        tableWriter.WriteAttributeString("ExecutionGroup", testInfo.ExecutionGroup);
                    }
                    tableWriter.WriteEndElement();
                }
                tableWriter.WriteEndElement();
            }
        }
コード例 #13
0
ファイル: LabReportGenerator.cs プロジェクト: dotnet/wpf-test
 private static void AppendNotes(XmlTableWriter tableWriter, RunInfo runInfo)
 {
     tableWriter.WriteStartElement("Notes");
     tableWriter.WriteEndElement();
 }