Пример #1
0
        private async Task <UserIterationResult> ExecuteTest(ILoadTest nextTest, IUserLoadTestHttpClient userLoadClient, Func <TimeSpan> getCurrentTimeSpan)
        {
            var userTime    = ValueStopwatch.StartNew();
            var startedTime = getCurrentTimeSpan();

            Exception exception = null;

            try
            {
                await nextTest.Execute(userLoadClient);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            var elapsedTime = userTime.GetElapsedTime();

            var statusResults = userLoadClient.StatusResults();

            return(new UserIterationResult(_httpUser.BaseUrl, UserNumber, elapsedTime, Iteration, nextTest.Name, statusResults, startedTime, userLoadClient.UserDelay, exception?.ToString()));
        }
Пример #2
0
        private async Task <UserIterationResult> ExecuteTest(ILoadTest nextTest, IUserLoadTestHttpClient userLoadClient)
        {
            _userTime.Restart();
            var startTick = Stopwatch.GetTimestamp();

            Exception exception = null;

            try
            {
                await nextTest.Execute(userLoadClient);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            _userTime.Stop();

            var endTick = startTick + _userTime.ElapsedTicks;

            var statusResults = userLoadClient.StatusResults();

            return(new UserIterationResult(_httpUser.BaseUrl, UserNumber, _userTime.Elapsed, Iteration, nextTest.Name, statusResults, startTick, endTick, userLoadClient.UserDelay, exception?.ToString()));
        }