Exemple #1
0
        private async void AssignProbe(SimulatedUser user)
        {
            if (user.bHasFinishedWork)
            {
                return;
            }

            user.NumberOfConcurrentUsers =
                SimulatedUserList.Where(x =>
                                        x.bHasStartedWork && !x.bHasFinishedWork).Count();

            EndpointProbe probe = TestSchedule.GetNextProbe();

            await Task.Run(async() =>
            {
                if (probe != null)
                {
                    if (user.bAsyncUser)
                    {
                        AssignProbe(user);
                    }

                    ProbeResult probeResult = await user.ExecuteProbe(probe);

                    ResultSet.Add(probeResult);
                    RaiseNewFreeUser(user);
                }
            });
        }
Exemple #2
0
        public void RunTest()
        {
            Globals.LoggingHandler.LogPerformance(Defaults.PerformanceLogHeader);
            RaiseNewFreeUser += AssignProbe;

            int endpointsToHit = TestSchedule.EndpointProbeList.Count;

            // initially assign one probe to each user
            foreach (SimulatedUser user in SimulatedUserList)
            {
                user.EndpointsToHit  = endpointsToHit;
                user.bHasStartedWork = true;
                AssignProbe(user);
                Thread.Sleep(TestSchedule.SpinUpDelayInMilliseconds);
            }

            while (SimulatedUserList
                   .Where(x => !x.bHasFinishedWork)
                   .Any())
            {
                // Console.WriteLine($"Progress: {SimulatedUserList.First().Progress}");
                Thread.Sleep(50);
            }
            ;
        }