Example #1
0
        void GenerateReports(ReportResult reportResult, string reportTypes)
        {
            Ensure.ArgumentIsNotNull(reportResult, "reportResult");

            if (BuildEnvironment.IsTeamCityBuild)
            {
                TeamCityReportGenerator.RenderReport(reportResult, this);
            }

            if (String.IsNullOrEmpty(reportTypes))
            {
                return;
            }

            Log(Level.Info, "Generating reports");
            foreach (string reportType in reportTypes.Split(';'))
            {
                string reportFileName = null;
                Log(Level.Verbose, "Report type: {0}", reportType);
                switch (reportType.ToLower())
                {
                case "text":
                    reportFileName = TextReport.RenderToText(reportResult, ReportDirectory, ReportFileNameFormat);
                    break;

                case "xml":
                    reportFileName = XmlReport.RenderToXml(reportResult, ReportDirectory, ReportFileNameFormat);
                    break;

                case "html":
                    reportFileName = HtmlReport.RenderToHtml(reportResult, ReportDirectory, ReportFileNameFormat);
                    break;

                case "dox":
                    reportFileName = DoxReport.RenderToDox(reportResult, ReportDirectory, ReportFileNameFormat);
                    break;

                case "transform":
                    if (Transform == null)
                    {
                        throw new BuildException(String.Format("No transform specified for report type '{0}'", reportType));
                    }

                    reportFileName = HtmlReport.RenderToHtml(reportResult,
                                                             ReportDirectory,
                                                             Transform.FullName,
                                                             TransformReportFileNameFormat);
                    break;

                default:
                    Log(Level.Error, "Unknown report type {0}", reportType);
                    break;
                }

                if (reportFileName != null)
                {
                    Log(Level.Info, "Created report at {0}", reportFileName);
                }
            }
        }
Example #2
0
 public void ReportToDox()
 {
     if (this.result == null)
     {
         AddLog("Result is a null reference. Make sure tests were executed succesfully");
         return;
     }
     AddLog("Generating Dox report");
     System.Diagnostics.Process.Start(DoxReport.RenderToDox(this.result, "", GetReportName()));
 }
Example #3
0
        private void RenderReport(string reportType)
        {
            this.Log.LogMessage("Render report {0}", reportType);
            string outputFileName = null;

            switch (reportType.ToLower())
            {
            case "text":
                outputFileName = TextReport.RenderToText(
                    result,
                    this.ReportOutputDirectory,
                    this.ReportFileNameFormat
                    );
                break;

            case "html":
                outputFileName = HtmlReport.RenderToHtml(
                    result,
                    this.ReportOutputDirectory,
                    this.ReportFileNameFormat);
                break;

            case "xml":
                outputFileName = XmlReport.RenderToXml(
                    result,
                    this.ReportOutputDirectory,
                    this.ReportFileNameFormat);
                break;

            case "dox":
                outputFileName = DoxReport.RenderToDox(
                    result,
                    this.ReportOutputDirectory,
                    this.ReportFileNameFormat);
                break;

            default:
                this.Log.LogError("Report type {0} not recognized.", reportType);
                return;
            }

            this.Log.LogMessage("Generated {0} report at {1}",
                                reportType,
                                outputFileName);
        }
Example #4
0
        private void GenerateReports()
        {
            if (result == null)
            {
                throw new InvalidOperationException("Report object is a null reference.");
            }

            this.Log(Level.Info, "Generating reports");
            foreach (string reportType in this.ReportTypes.Split(';'))
            {
                string reportName = null;
                this.Log(Level.Verbose, "Report type: {0}", reportType);
                switch (reportType.ToLower())
                {
                case "text":
                    reportName = TextReport.RenderToText(result, this.ReportOutputDirectory, this.ReportFileNameFormat);
                    break;

                case "xml":
                    reportName = XmlReport.RenderToXml(result, this.ReportOutputDirectory, this.ReportFileNameFormat);
                    break;

                case "html":
                    reportName = HtmlReport.RenderToHtml(result, this.ReportOutputDirectory, this.ReportFileNameFormat);
                    break;

                case "dox":
                    reportName = DoxReport.RenderToDox(result, this.ReportOutputDirectory, this.ReportFileNameFormat);
                    break;

                default:
                    this.Log(Level.Error, "Unknown report type {0}", reportType);
                    break;
                }
                if (reportName != null)
                {
                    this.Log(Level.Info, "Created report at {0}", reportName);
                }
            }
        }
Example #5
0
        private void GenerateReport(MainArguments parsedArgs, ReportResult result)
        {
            result.UpdateCounts();
            if (parsedArgs.ReportTypes != null && parsedArgs.ReportTypes.Length > 0)
            {
                parsedArgs.ReportFolder = ReportBase.GetAppDataPath(parsedArgs.ReportFolder);
                consoleOut.WriteLine("[info] Creating reports in {0}", Path.GetFullPath(parsedArgs.ReportFolder));
                foreach (ReportType rt in parsedArgs.ReportTypes)
                {
                    string outputPath = null;
                    switch (rt)
                    {
                    case ReportType.Xml:
                        outputPath = XmlReport.RenderToXml(result, parsedArgs.ReportFolder, parsedArgs.Transform, parsedArgs.ReportNameFormat);
                        consoleOut.WriteLine("[info] Created xml report {0}", outputPath);
                        break;

                    case ReportType.Html:
                        outputPath = HtmlReport.RenderToHtml(result, parsedArgs.ReportFolder, parsedArgs.Transform, parsedArgs.ReportNameFormat);
                        consoleOut.WriteLine("[info] Created Html report {0}", outputPath);
                        break;

                    case ReportType.Text:
                        outputPath = TextReport.RenderToText(result, parsedArgs.ReportFolder, parsedArgs.Transform, parsedArgs.ReportNameFormat);
                        consoleOut.WriteLine("[info] Created Text report {0}", outputPath);
                        break;

                    case ReportType.Dox:
                        outputPath = DoxReport.RenderToDox(result, parsedArgs.ReportFolder, parsedArgs.ReportNameFormat);
                        consoleOut.WriteLine("[info] Created Dox report {0}", outputPath);
                        break;
                    }
                    if (parsedArgs.ShowReports && File.Exists(outputPath))
                    {
                        System.Diagnostics.Process.Start(outputPath);
                    }
                }
            }
        }
Example #6
0
        public void Render(MbUnit task, ReportResult result)
        {
            string nameFormat = "mbunit-{0}{1}";
            string outputPath = "";

            if (this.fileNameFormat.Length != 0)
            {
                nameFormat = fileNameFormat;
            }
            if (this.OutputDirectory.Length != 0)
            {
                outputPath = OutputDirectory;
            }

            string outputFileName = null;

            switch (this.Type)
            {
            case FormatterType.Text:
                outputFileName = TextReport.RenderToText(result, outputPath, nameFormat);
                break;

            case FormatterType.Html:
                outputFileName = HtmlReport.RenderToHtml(result, outputPath, nameFormat);
                break;

            case FormatterType.Xml:
                outputFileName = XmlReport.RenderToXml(result, outputPath, nameFormat);
                break;

            case FormatterType.Dox:
                outputFileName = DoxReport.RenderToDox(result, outputPath, nameFormat);
                break;
            }

            task.Log.LogMessage("Generated {0} report at {1}",
                                this.Type,
                                outputFileName);
        }
Example #7
0
        public void GenerateDoxReport()
        {
            string outputPath = DoxReport.RenderToDox(this.TestDomains.GetReport());

            System.Diagnostics.Process.Start(outputPath);
        }