Example #1
0
        public JMeterDataResultsResponse ProcessLogs(JMeterLogsRequest request)
        {
            var stream = new MemoryStream(Encoding.UTF8.GetBytes(request.Logs));
            // Deserialize logs
            var xmlSerializer = new XmlSerializer<testResults>();
            var testResults = xmlSerializer.Deserialize(stream);

            // create data results
            var dataProcessor = new TestResultsProcessor(testResults);
            dataProcessor.CreateDataResults();
            return new JMeterDataResultsResponse() {DataResults = dataProcessor.DataResults.ToArray()};
        }
Example #2
0
        public void Execute()
        {
            var fileName = Path.GetFileNameWithoutExtension(_file);
            var path = Path.GetDirectoryName(_file);
            if (path != null)
            {
                var output = Path.Combine(path, fileName + "_" + DateTime.Now.ToString("ddMMyyyy") + ".jpeg");
                using (var fs = new FileStream(_file, FileMode.Open, FileAccess.Read))
                {
                    var request = new JMeterLogsRequest {Logs = fs.ReadContent()};

                    var dataResultsResponse = _service.ProcessLogs(request);
                    var chartResponse =
                        _service.GenerateCharts(new JMeterDataResultsRequest { DataResults = dataResultsResponse.DataResults });
                    using (var outputStream = new FileStream(output, FileMode.Create, FileAccess.ReadWrite))
                    {
                        outputStream.Write(chartResponse.Charts[0].Data, 0, chartResponse.Charts[0].Data.Length);
                        Console.WriteLine("{0} Done", output);
                    }
                }
            }
        }