コード例 #1
0
        private static void WriteXmlReport(TestReportCollection testReports, string xmlReportOutputPath, ReportOutputFileType reportOutputFileType)
        {
            if (!string.IsNullOrEmpty(xmlReportOutputPath))
            {
                IXmlReport xmlReport;
                switch (reportOutputFileType)
                {
                case ReportOutputFileType.MSGenericTest:
                    xmlReport = new Reporting.Providers.TFS.TFS2010.MSGenericTestXmlReport(testReports);
                    break;

                case ReportOutputFileType.StatLight:
                    xmlReport = new Reporting.Providers.Xml.XmlReport(testReports);
                    break;

                case ReportOutputFileType.NUnit:
                    xmlReport = new Reporting.Providers.NUnit.NUnitXmlReport(testReports);
                    break;

                case ReportOutputFileType.TRX:
                    xmlReport = new TRXReport(testReports);
                    break;

                default:
                    throw new StatLightException("Unknown ReportOutputFileType chosen Name=[{0}], Value=[{1}]".FormatWith(reportOutputFileType.ToString(), (int)reportOutputFileType));
                }

                xmlReport.WriteXmlReport(xmlReportOutputPath);

                "*********************************"
                .WrapConsoleMessageWithColor(Settings.Default.ConsoleColorInformation, true);

                "Wrote XML report to:{0}{1}"
                .FormatWith(Environment.NewLine, new FileInfo(xmlReportOutputPath).FullName)
                .WrapConsoleMessageWithColor(Settings.Default.ConsoleColorWarning, true);

                "*********************************"
                .WrapConsoleMessageWithColor(Settings.Default.ConsoleColorInformation, true);
            }
        }
コード例 #2
0
        private static void WriteXmlReport(TestReportCollection testReports, string xmlReportOutputPath, ReportOutputFileType reportOutputFileType)
        {
            if (!string.IsNullOrEmpty(xmlReportOutputPath))
            {
                IXmlReport xmlReport;
                switch (reportOutputFileType)
                {
                    case ReportOutputFileType.MSGenericTest:
                        xmlReport = new Reporting.Providers.TFS.TFS2010.MSGenericTestXmlReport(testReports);
                        break;
                    case ReportOutputFileType.StatLight:
                        xmlReport = new Reporting.Providers.Xml.XmlReport(testReports);
                        break;
                    case ReportOutputFileType.NUnit:
                        xmlReport = new Reporting.Providers.NUnit.NUnitXmlReport(testReports);
                        break;
                    case ReportOutputFileType.TRX:
                        xmlReport = new TRXReport(testReports);
                        break;
                    default:
                        throw new StatLightException("Unknown ReportOutputFileType chosen Name=[{0}], Value=[{1}]".FormatWith(reportOutputFileType.ToString(), (int)reportOutputFileType));
                }

                xmlReport.WriteXmlReport(xmlReportOutputPath);

                "*********************************"
                    .WrapConsoleMessageWithColor(Settings.Default.ConsoleColorInformation, true);

                "Wrote XML report to:{0}{1}"
                    .FormatWith(Environment.NewLine, new FileInfo(xmlReportOutputPath).FullName)
                    .WrapConsoleMessageWithColor(Settings.Default.ConsoleColorWarning, true);

                "*********************************"
                    .WrapConsoleMessageWithColor(Settings.Default.ConsoleColorInformation, true);
            }
        }