Exemplo n.º 1
0
        public string Build(JMeterData data, TemplatesProvider provider)
        {
            var allResultsTableTemplate = provider.AllResultsTableTemplate;
            var sb = new StringBuilder();
            var i = 0;
            foreach (var row in data.Rows)
            {
                BuildRow(row.PlainData, sb, i);
                i++;
            }

            return string.Format(allResultsTableTemplate, sb);
        }
Exemplo n.º 2
0
        private string process(JMeterData allData, TemplatesProvider provider)
        {
            // let split them by label
            var jDatas = from row in allData.Rows
                         group row by row.Label into grouped
                         select new JMeterData(grouped.ToList(), grouped.Key.Trim());

            var sb = new StringBuilder();

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

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

            var formatted = string.Format(provider.HtmlPageTemplate, sb.ToString(), allResultstable);
            return formatted;
        }
Exemplo n.º 3
0
        public void CreateHtmlResult(JMeterData sourceData)
        {
            // here we have all methods in one big table (ALL RESULTS)           
            var reprot = process(sourceData, _templatesProvider);
            writeResult(reprot, _config.OutputPath);

            if (!string.IsNullOrEmpty(_config.AnalysisOutputPath))
            {
                var analysisHtml = processAnalysis(sourceData);
                writeResult(analysisHtml, _config.AnalysisOutputPath);
            }

            // Get just those where are erros
            var errors = sourceData.Rows.Where(it => it.ResponceCode != "200").ToList();
            if (errors.Count > 0 && !string.IsNullOrEmpty(_config.ErrorsOutputPath))
            {
                var erorsLog = process(new JMeterData(errors , ""), _templatesProvider);
                writeResult(erorsLog, _config.ErrorsOutputPath);
            }


        }
Exemplo n.º 4
0
        // Prepare analysis table
        private string processAnalysis(JMeterData allData)
        {

            var tableBuilder = new HtmlTableBuilder();

            var sbTotal = new StringBuilder();
            var total = allData.AnaliseResponseTimes();
            // remove Method name because it is not used
            total.RemoveAt(0);
            tableBuilder.BuildRow(total, sbTotal, 0);


            // let split all results by method
            var jDatas = from row in allData.Rows
                         group row by row.Label into grouped
                         select new JMeterData(grouped.ToList(), grouped.Key.Trim());

            int i = 0;
            var sb = new StringBuilder();
            foreach (var methodData in jDatas)
            {
                // get analyzed data per each method
                var analyzed = methodData.AnaliseResponseTimes();
                // add to stringBuilder sb, to get this data as row <tr> </tr>. Use i to determine odd or even row.
                tableBuilder.BuildRow(analyzed, sb, i++);
            }
           
            var formatted = string.Format(_templatesProvider.AnalysisTableTemplate, sb.ToString(), getConfData(), sbTotal.ToString());
            return formatted;
        }