コード例 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="velocityEngine">The velocity engine</param>
        /// <param name="velocityContext">The current velocity context.</param>
        /// <param name="reportWriter">The report writer</param>
        /// <param name="templatePath">The template path.</param>
        /// <param name="contentType">The content type of the report.</param>
        /// <param name="extension">The extension of the report file.</param>
        /// <param name="helper">The formatting helper class.</param>
        /// <param name="pageSize">The number of test steps displayed in one page.</param>
        public MultipleFilesVtlReportWriter(VelocityEngine velocityEngine, VelocityContext velocityContext, IReportWriter reportWriter, string templatePath, string contentType, string extension, FormatHelper helper, int pageSize)
            : base(velocityEngine, velocityContext, reportWriter, templatePath, contentType, extension, helper)
        {
            if (pageSize <= 0)
                throw new ArgumentOutOfRangeException("size", "Must be greater than zero.");

            this.pageSize = pageSize;
        }
コード例 #2
0
 /// <inheritdoc />
 public VelocityContext CreateVelocityContext(IReportWriter reportWriter, FormatHelper helper)
 {
     var context = new VelocityContext();
     context.Put("report", reportWriter.Report);
     var root = reportWriter.Report.TestPackageRun == null ? null : reportWriter.Report.TestPackageRun.RootTestStepRun;
     context.Put("tree", TestStepRunNode.BuildTreeFromRoot(root));
     context.Put("helper", helper);
     context.Put("resourceRoot", reportWriter.ReportContainer.ReportName);
     context.Put("passed", TestStatus.Passed);
     context.Put("failed", TestStatus.Failed);
     context.Put("skipped", TestStatus.Skipped);
     context.Put("inconclusive", TestStatus.Inconclusive);
     context.Put("pagingEnabled", false);
     context.Put("pageIndex", 0);
     context.Put("pageSize", 0);
     context.Put("pageCount", 1);
     return context;
 }
コード例 #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="velocityEngine">The velocity engine</param>
        /// <param name="velocityContext">The current velocity context.</param>
        /// <param name="reportWriter">The report writer</param>
        /// <param name="templatePath">The template path.</param>
        /// <param name="contentType">The content type of the report.</param>
        /// <param name="extension">The extension of the report file.</param>
        /// <param name="helper">The formatting helper class.</param>
        /// <param name="pageSize">The number of test steps displayed in one page.</param>
        public MultipleFilesVtlReportWriter(VelocityEngine velocityEngine, VelocityContext velocityContext, IReportWriter reportWriter, string templatePath, string contentType, string extension, FormatHelper helper, int pageSize)
            : base(velocityEngine, velocityContext, reportWriter, templatePath, contentType, extension, helper)
        {
            if (pageSize <= 0)
            {
                throw new ArgumentOutOfRangeException("size", "Must be greater than zero.");
            }

            this.pageSize = pageSize;
        }
コード例 #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="velocityEngine">The velocity engine</param>
        /// <param name="velocityContext">The current velocity context.</param>
        /// <param name="reportWriter">The report writer</param>
        /// <param name="templatePath">The template path.</param>
        /// <param name="contentType">The content type of the report.</param>
        /// <param name="extension">The extension of the report file.</param>
        /// <param name="helper">The formatting helper class.</param>
        protected VtlReportWriter(VelocityEngine velocityEngine, VelocityContext velocityContext, IReportWriter reportWriter, 
            string templatePath, string contentType, string extension, FormatHelper helper)
        {
            if (velocityEngine == null)
                throw new ArgumentNullException("velocityEngine");
            if (velocityContext == null)
                throw new ArgumentNullException("velocityContext");
            if (reportWriter == null)
                throw new ArgumentNullException("reportWriter");
            if (templatePath == null)
                throw new ArgumentNullException("templatePath");
            if (contentType == null)
                throw new ArgumentNullException("contentType");
            if (extension == null)
                throw new ArgumentNullException("extension");
            if (helper == null)
                throw new ArgumentNullException("helper");

            this.velocityEngine = velocityEngine;
            this.velocityContext = velocityContext;
            this.reportWriter = reportWriter;
            this.templatePath = templatePath;
            this.contentType = contentType;
            this.extension = extension;
            this.helper = helper;
            InitializeHelper();
        }
コード例 #5
0
        private VtlReportWriter GetReportWriter(VelocityEngine velocityEngine, VelocityContext velocityContext, IReportWriter reportWriter, FormatHelper helper, ReportFormatterOptions options)
        {
            int pageSize = GetReportPageSize(options);
            int testCount = (reportWriter.Report.TestPackageRun == null) ? 0 : reportWriter.Report.TestPackageRun.Statistics.TestCount;

            if (pageSize < 0)
            {
                HtmlReportSplitSettings settings = preferenceManager.HtmlReportSplitSettings;
                pageSize = settings.Enabled ? settings.PageSize : 0;
            }

            if (supportSplit && pageSize > 0 && testCount > pageSize)
                return new MultipleFilesVtlReportWriter(velocityEngine, velocityContext, reportWriter, templatePath, contentType, extension, helper, pageSize);

            return new SingleFileVtlReportWriter(velocityEngine, velocityContext, reportWriter, templatePath, contentType, extension, helper);
        }
コード例 #6
0
 /// <summary>
 /// Applies the template to produce a report.
 /// </summary>
 protected virtual void ApplyTemplate(IReportWriter reportWriter, AttachmentContentDisposition attachmentContentDisposition, ReportFormatterOptions options)
 {
     VelocityEngine velocityEngine = VelocityEngineFactory.CreateVelocityEngine();
     var helper = new FormatHelper();
     VelocityContext velocityContext = VelocityEngineFactory.CreateVelocityContext(reportWriter, helper);
     var writer = GetReportWriter(velocityEngine, velocityContext, reportWriter, helper, options);
     reportWriter.WithUpdatedContentPathsAndDisposition(attachmentContentDisposition, writer.Run);
 }
コード例 #7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="velocityEngine">The velocity engine</param>
 /// <param name="velocityContext">The current velocity context.</param>
 /// <param name="reportWriter">The report writer</param>
 /// <param name="templatePath">The template path.</param>
 /// <param name="contentType">The content type of the report.</param>
 /// <param name="extension">The extension of the report file.</param>
 /// <param name="helper">The formatting helper class.</param>
 public SingleFileVtlReportWriter(VelocityEngine velocityEngine, VelocityContext velocityContext, IReportWriter reportWriter, string templatePath, string contentType, string extension, FormatHelper helper)
     : base(velocityEngine, velocityContext, reportWriter, templatePath, contentType, extension, helper)
 {
 }
コード例 #8
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="velocityEngine">The velocity engine</param>
 /// <param name="velocityContext">The current velocity context.</param>
 /// <param name="reportWriter">The report writer</param>
 /// <param name="templatePath">The template path.</param>
 /// <param name="contentType">The content type of the report.</param>
 /// <param name="extension">The extension of the report file.</param>
 /// <param name="helper">The formatting helper class.</param>
 public SingleFileVtlReportWriter(VelocityEngine velocityEngine, VelocityContext velocityContext, IReportWriter reportWriter, string templatePath, string contentType, string extension, FormatHelper helper)
     : base(velocityEngine, velocityContext, reportWriter, templatePath, contentType, extension, helper)
 {
 }