Ejemplo n.º 1
0
 public string Process(CsvData data, TemplatesProvider provider)
 {
     var table = new HtmlTableBuilder();
     var tableHtml = table.Build(data, provider);
     var formatted = string.Format(provider.HtmlPageTemplate, tableHtml);
     return formatted;
 }
Ejemplo n.º 2
0
        public void CreateHtmlResult(CsvData sourceData)
        {
            var internalProcessor = getProcessor();
            // process all data
            var reprot = internalProcessor.Process(sourceData, _templatesProvider);

            var errors = sourceData.Rows.Where(it => it.PlainData[3] != "200").ToList();
            if (errors.Count > 0 && !string.IsNullOrEmpty(_config.ErrorsOutputPath))
            {
                var errorProcessor = getProcessor();
                var erorsLog = errorProcessor.Process(new CsvData() { Rows = errors}, _templatesProvider);                
                writeResult(erorsLog,_config.ErrorsOutputPath);
            }          
       
            writeResult(reprot,_config.OutputPath);
        }
Ejemplo n.º 3
0
        public string Build(CsvData data, TemplatesProvider provider)
        {
            var allResultsTableTemplate = provider.AllResultsTableTemplate;
            var sb = new StringBuilder();
            var i = 0;
            foreach (var row in data.Rows)
            {
                var rowClass = i % 2 == 0 ? "evenRow" : "oddRow";
                sb.AppendLine($"<tr class=\"{rowClass}\">");
                foreach (var s in row.PlainData)
                {
                    sb.Append($"<td>{s}</td>");
                }
                sb.AppendLine("</tr>");
                i++;
            }

            return string.Format(allResultsTableTemplate, sb);
        }
Ejemplo n.º 4
0
        public CsvData Parse()
        {
            var path = _config.InputPath;
            var data = new CsvData();

            Console.WriteLine("Loading csv report...");
            using (var stream = new StreamReader(path))
            {
                string line;
                while ((line = stream.ReadLine()) != null)
                {
                    var row = new CsvRow();
                    row.PlainData = line.Split(',');
                    data.Rows.Add(row);
                }
            }
            Console.WriteLine("Parsed!");
            return data;
        }
Ejemplo n.º 5
0
        public string Process(CsvData data, TemplatesProvider provider)
        {          
            var jDatas = from row in data.Rows
                         group row by row.PlainData[2] into grouped
                         select new JMeterData(grouped.ToList(), grouped.Key.Trim());

            var sb = new StringBuilder();

            foreach (var methodData in jDatas)
            {
                var summaryTable = new HtmlSummaryBuilder().Build(methodData.Summary, methodData.MethodName, provider);
                sb.Append(summaryTable);
            }


            var allResultstable = new HtmlTableBuilder().Build(data, provider);

            var formatted = string.Format(provider.HtmlPageTemplate, sb.ToString(), allResultstable);
            return formatted;
        }