예제 #1
0
        internal ConfigReportData GetConfigReportData()
        {
            ConfigReportData config = new ConfigReportData();

            config.ConfigFile              = _configJsonPath;
            config.DataFile                = _dataFilePath;
            config.RequestTemplateFile     = _requestTemplateFile;
            config.Threads                 = _threads;
            config.TraceRequestFolder      = _traceRequestFolder;
            config.TraceResponseFolder     = _traceResponseFolder;
            config.TraceHttpResponseFolder = _traceHttpResponseFolder;
            config.TraceErrorFolder        = _traceErrorFolder;
            config.Uri = _requestUri.ToString();

            return(config);
        }
예제 #2
0
        internal void WriteLogs(ConfigReportData configReportData)
        {
            ReportData ed = PrepareReportData(configReportData);

            WriteReportData(ed);
        }
예제 #3
0
        private ReportData PrepareReportData(ConfigReportData crd)
        {
            ReportData ed = new ReportData();

            ed.ConfigParameters = crd;

            long?prepare = GetDuration(EventType.PrepareTestStart, EventType.PrepareTestEnd);
            long?runTest = GetDuration(EventType.RunTestStart, EventType.RunTestEnd);
            long?connect = GetDuration(EventType.CreateThreadsAndConnectStart, EventType.CreateThreadsAndConnectEnd);
            long?request = GetDuration(EventType.SendRequestsStart, EventType.SendRequestsEnd);
            long?convert = GetDuration(EventType.Tcp2HttpResponsesConversionStart, EventType.Tcp2HttpResponsesConversionEnd);
            ExecutionReportDurationData dd = new ExecutionReportDurationData
            {
                Overall = _globalEvents.Last().GlobalElapsedMilliseconds,
                Prepare = prepare,
                RunTest = runTest,
                Connect = connect,
                Request = request,
                Convert = convert
            };

            ed.ExecutionReport = new ExecutionReportData
            {
                Started   = _globalStartDt,
                Completed = _globalEvents.Last().Dt,
                DurationInMilliseconds = dd
            };

            int         failedOnConnect        = _wiDataList.Count(d => d.ConnectionFailed);
            int         failedOnRequest        = _wiDataList.Count(d => d.RequestFailed);
            int         failedOnConvert        = _wiDataList.Count(d => d.ConvertFailed);
            List <long> responsesAppearedTimes = _wiDataList.Select(d => d.Events.FirstOrDefault(e => e.Type == WiEventType.FirstBlockReceived)?.ElapsedMilliseconds)
                                                 .Where(em => em.HasValue).Select(em => em.Value).ToList();
            long?firstResponseAppeared = (responsesAppearedTimes.Count == 0 ? (long?)null : responsesAppearedTimes.Min());
            long?lastResponseAppeared  = (responsesAppearedTimes.Count == 0 ? (long?)null : responsesAppearedTimes.Max());

            PhaseDurationData connectDuration = GetPhaseDurationData(WiEventType.Connection, WiEventType.Connected);
            PhaseDurationData sendDuration    = GetPhaseDurationData(WiEventType.RequestStarted, WiEventType.RequestSent);
            PhaseDurationData receiveDuration = GetPhaseDurationData(WiEventType.RequestSent, WiEventType.Received);
            PhaseDurationData convertDuration = GetPhaseDurationData(WiEventType.ConversionStarted, WiEventType.ConversionCompleted);

            ed.TestMetrics = new TestMetricsData
            {
                SuccessOnConnect = crd.Threads - failedOnConnect,
                SuccessOnRequest = crd.Threads - failedOnConnect - failedOnRequest,
                ErrorsOnConnect  = failedOnConnect,
                ErrorsOnRequest  = failedOnRequest,
                ConnectDuration  = connectDuration,
                SendDuration     = sendDuration,
                ReceiveDuration  = receiveDuration,
                FirstResponseAppearedAfterTestStarted = firstResponseAppeared,
                LastResponseAppearedAfterTestStarted  = lastResponseAppeared
            };

            ed.ConvertMetrics = new ConvertMetricsData
            {
                SuccessOnConvert = crd.Threads - failedOnConnect - failedOnRequest,
                ErrorsOnConvert  = failedOnConvert,
                ConvertDuration  = convertDuration
            };

            return(ed);
        }