Exemplo n.º 1
0
        public void RenderTimeTaken()
        {
            ClearSeries();

            var parser = new ResultsParser();
            var times  = parser.TimeLineDataForIndividualRequest(Results, Url);

            var pane = Chart.GraphPane;

            pane.Title.Text = "Time taken per request for\r\n" + Url;
            pane.Title.FontSpec.FontColor = Color.DarkBlue;
            pane.Title.FontSpec.Size      = 14.25F;
            pane.Title.FontSpec.IsBold    = true;


            pane.LineType           = LineType.Normal;
            pane.XAxis.Title.Text   = "Request number";
            pane.YAxis.Title.Text   = "milli-seconds";
            pane.Chart.Fill         = new Fill(Color.LightYellow, Color.PaleGoldenrod, 45.0F);
            Chart.IsShowPointValues = true;

            PointPairList series = new PointPairList();


            foreach (var req in times.Where(t => !t.IsError))
            {
                var pt = new PointPair(req.RequestNo, req.TimeTaken, req.TimeTaken.ToString());
                series.Add(pt);
            }

            var curve = pane.AddCurve("Success", series, Color.Green, SymbolType.Circle);

            curve.Line.Width       = 2.0F;
            curve.Line.IsAntiAlias = true;
            curve.Symbol.Fill      = new Fill(Color.LightYellow);
            curve.Symbol.Size      = 4;

            PointPairList series2 = new PointPairList();


            foreach (var req in times.Where(t => t.IsError))
            {
                var point = new PointPair(req.TimeTaken, req.RequestNo);
                series2.Add(point);
            }

            var curve2 = pane.AddCurve("Errors", series2, Color.Red);

            curve2.Line.Width       = 2.0F;
            curve2.Line.IsAntiAlias = true;
            curve2.Symbol.Fill      = new Fill(Color.White);
            curve2.Symbol.Size      = 4;

            // Force refresh of chart
            pane.AxisChange();
        }
Exemplo n.º 2
0
        public void RenderTimeTaken()
        {
            ClearSeries();

            var parser = new ResultsParser();
            var times = parser.TimeLineDataForIndividualRequest(Results,Url);

            var pane = Chart.GraphPane;

            pane.Title.Text = "Time taken per request for\r\n" + Url;
            pane.Title.FontSpec.FontColor = Color.DarkBlue;
            pane.Title.FontSpec.Size = 14.25F;
            pane.Title.FontSpec.IsBold = true;

            pane.LineType = LineType.Normal;
            pane.XAxis.Title.Text = "Request number";
            pane.YAxis.Title.Text = "milli-seconds";
            pane.Chart.Fill = new Fill(Color.LightYellow, Color.PaleGoldenrod, 45.0F);
            Chart.IsShowPointValues = true;

            PointPairList series = new PointPairList();

            foreach (var req in times.Where( t=> !t.IsError ))
            {
                var pt = new PointPair(req.RequestNo, req.TimeTaken,req.TimeTaken.ToString());
                series.Add(pt);
            }

            var curve = pane.AddCurve("Success", series, Color.Green, SymbolType.Circle);
            curve.Line.Width = 2.0F;
            curve.Line.IsAntiAlias = true;
            curve.Symbol.Fill = new Fill(Color.LightYellow);
            curve.Symbol.Size = 4;

            PointPairList series2 = new PointPairList();

            foreach (var req in times.Where( t=> t.IsError ))
            {
                var point = new PointPair(req.TimeTaken,req.RequestNo);
                series2.Add(point);
            }

            var curve2 = pane.AddCurve("Errors", series2, Color.Red);
            curve2.Line.Width = 2.0F;
            curve2.Line.IsAntiAlias = true;
            curve2.Symbol.Fill = new Fill(Color.White);
            curve2.Symbol.Size = 4;

            // Force refresh of chart
            pane.AxisChange();
        }
Exemplo n.º 3
0
        private void RenderRequestsPerSecond()
        {
            ClearSeries();

            var parser = new ResultsParser();
            var reqs   = parser.RequestsPerSecond(RequestWriter);

            var pane = Chart.GraphPane;

            pane.Title.Text = "Requests per Second";
            pane.Title.FontSpec.FontColor = Color.DarkBlue;
            pane.Title.FontSpec.Size      = 14.25F;
            pane.Title.FontSpec.IsBold    = true;


            pane.LineType            = LineType.Normal;
            pane.XAxis.Title.Text    = "second of test";
            pane.YAxis.Title.Text    = "requests / second";
            pane.Chart.Fill          = new Fill(Color.LightYellow, Color.PaleGoldenrod, 45.0F);
            Chart.IsShowPointValues  = true;
            Chart.GraphPane.LineType = LineType.Normal;
            PointPairList series = new PointPairList();

            foreach (var req in reqs)
            {
                var point = new PointPair(req.Second, req.Requests);
                series.Add(point);
            }

            var curve = pane.AddCurve("", series, Color.Green);

            curve.Line.Width       = 4.0F;
            curve.Line.IsAntiAlias = true;
            curve.Line.Fill        = new Fill(Color.White, Color.Green, 45F);
            curve.Symbol.Fill      = new Fill(Color.LightYellow);
            curve.Symbol.Size      = 4;

            // activate the cardinal spline smoothing
            curve.Line.IsSmooth      = true;
            curve.Line.SmoothTension = 0.5F;

            // Force refresh of chart
            pane.AxisChange();
        }
Exemplo n.º 4
0
        private void RenderRequestsPerSecond()
        {
            ClearSeries();

            var parser = new ResultsParser();
            var reqs = parser.RequestsPerSecond(Results);

            var pane = Chart.GraphPane;

            pane.Title.Text = "Requests per Second";
            pane.Title.FontSpec.FontColor = Color.DarkBlue;
            pane.Title.FontSpec.Size = 14.25F;
            pane.Title.FontSpec.IsBold = true;

            pane.LineType = LineType.Normal;
            pane.XAxis.Title.Text = "second of test";
            pane.YAxis.Title.Text = "requests / second";
            pane.Chart.Fill = new Fill(Color.LightYellow, Color.PaleGoldenrod, 45.0F);
            Chart.IsShowPointValues = true;
            Chart.GraphPane.LineType = LineType.Normal;
            PointPairList series = new PointPairList();

            foreach (var req in reqs)
            {
                var point = new PointPair(req.Second, req.Requests);
                series.Add(point);
            }

            var curve = pane.AddCurve("",series,Color.Green);

            curve.Line.Width = 4.0F;
            curve.Line.IsAntiAlias = true;
            curve.Line.Fill = new Fill(Color.White, Color.Green, 45F);
            curve.Symbol.Fill = new Fill(Color.LightYellow);
            curve.Symbol.Size = 4;

            // activate the cardinal spline smoothing
            curve.Line.IsSmooth = true;
            curve.Line.SmoothTension = 0.5F;

            // Force refresh of chart
            pane.AxisChange();
        }
        public void RequestSummaryTest()
        {
            var time = DateTime.UtcNow;

            var requests = new List<HttpRequestData>()
            {
                new HttpRequestData()
                {
                    Url = "http://localhost/",
                    Timestamp = time,
                    IsError = false,
                    TimeTakenMs = 10
                },
                new HttpRequestData()
                {
                    Url = "http://localhost/wconnect",
                    Timestamp = time.AddMilliseconds(20),
                    IsError = false,
                    TimeTakenMs = 15
                },
                new HttpRequestData
                {
                    Url = "http://localhost/",
                    Timestamp = time.AddMilliseconds(220),
                    IsError = false,
                    TimeTakenMs = 15
                },
                new HttpRequestData
                {
                    Url = "http://localhost/",
                    Timestamp = time.AddMilliseconds(1020),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url = "http://localhost/wconnect",
                    Timestamp = time.AddMilliseconds(1050),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url = "http://localhost/",
                    Timestamp = time.AddMilliseconds(1200),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url = "http://localhost/",
                    Timestamp = time.AddMilliseconds(3020),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url = "http://localhost/",
                    Timestamp = time.AddMilliseconds(3050),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url = "http://localhost/wconnect",
                    Timestamp = time.AddMilliseconds(3200),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url = "http://localhost/wconnect",
                    Timestamp = time.AddMilliseconds(3500),
                    TimeTakenMs = 50
                },
                new HttpRequestData
                {
                    Url = "http://localhost/wconnect/testpage",
                    Timestamp = time.AddMilliseconds(3100),
                    IsError = false,
                    TimeTakenMs = 50
                },
                new HttpRequestData
                {
                    Url = "http://localhost/wconnect/testpage",
                    IsError = false,
                    Timestamp = time.AddMilliseconds(3200),
                    TimeTakenMs = 57
                },
                new HttpRequestData
                {
                    Url = "http://localhost/wconnect/testpage2",
                    Timestamp = time.AddMilliseconds(3100),
                    TimeTakenMs = 50
                },
                new HttpRequestData
                {
                    Url = "http://localhost/wconnect/testpage2",
                    Timestamp = time.AddMilliseconds(3200),
                    TimeTakenMs = 57
                }

            };

            var parser = new ResultsParser();
            var res = parser.UrlSummary(requests, 200);

            Assert.IsNotNull(res);
            Assert.IsTrue(res.Count() > 0);

            foreach (var r in res)
            {
                Console.WriteLine(r.Url + ": " +  JsonSerializationUtils.Serialize(r.Results,false,true));
            }

            var html = parser.GetResultReportHtml(requests,10,2);
            Console.WriteLine(html);

            var file = App.UserDataPath + "html\\_preview.html";

            File.WriteAllText(file, html);
            ShellUtils.GoUrl(file);
        }
        public void RequestPerSecondListTest()
        {
            var time = DateTime.UtcNow;

            var requests = new List<HttpRequestData>()
            {
                new HttpRequestData()
                {
                    Timestamp = time,
                    TimeTakenMs = 10
                },
                new HttpRequestData()
                {
                    Timestamp = time.AddMilliseconds(20),
                    TimeTakenMs = 15
                },
                new HttpRequestData
                {
                    Timestamp = time.AddMilliseconds(220),
                    TimeTakenMs = 15
                },
                new HttpRequestData
                {
                    Timestamp = time.AddMilliseconds(1020),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Timestamp = time.AddMilliseconds(1050),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Timestamp = time.AddMilliseconds(1200),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Timestamp = time.AddMilliseconds(3020),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Timestamp = time.AddMilliseconds(3050),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Timestamp = time.AddMilliseconds(3200),
                    TimeTakenMs = 20
                },  new HttpRequestData
                {
                    Timestamp = time.AddMilliseconds(3500),
                    TimeTakenMs = 50
                }
            };

            var parser = new ResultsParser();
            var res = parser.RequestsPerSecond(requests);

            Assert.IsNotNull(res);
            foreach (var r in res)
            {
                Console.WriteLine(r.Second + ": " + r.Requests);
            }
        }