private PerformanceSuite(IEnumerable <ILoadRunner> testRunners, IRunStrategy runStrategy, IPerformanceTestRunnerListener listener, TimeSpan?runTimeout)
 {
     m_runStrategy = runStrategy;
     m_listener    = listener;
     m_loadRunners = new List <ILoadRunner>(testRunners);
     m_runTimeout  = runTimeout;
 }
Exemple #2
0
        private Action TestToAction(IPerformanceTest test, Barrier barrier, IPerformanceTestRunnerListener listener)
        {
            return(() =>
            {
                if (!barrier.SignalAndWait(BarrierWaitTimeout))
                {
                    throw new TestFirstException("Timed out waiting for 'Invoke' barrier");
                }
                var testListener = new TestListenerAdapter(listener, new PerformanceSuite.PerfTestContext {
                    AgentId = "0", MachineId = Environment.MachineName
                });
                test.InvokeTest(testListener);

                if (!barrier.SignalAndWait(BarrierWaitTimeout))
                {
                    throw new TestFirstException("Timed out waiting for 'AfterInvokeInTestThread' barrier");
                }
            });
        }
Exemple #3
0
        public void Start(PerformanceSuite.PerfTestContext ctxt, IPerformanceTestRunnerListener runListener)
        {
            m_endAt = DateTime.Now.Add(m_runFor);
            m_threads.Clear();
            m_threads = new List <ActionCompleteThread>();
            for (var i = 01; i < m_numThreads; i++)
            {
                var threadListener = new TestListenerAdapter(runListener, ctxt);
                var threadAction   = NewInvokeTestAction(threadListener);
                m_threads.Add(new ActionCompleteThread(threadAction.Invoke).Where(t => t.Priority = m_threadPriority));
            }

            m_threads.ForEach(t => t.Start());
            //wait for runners to complete
            while (DateTime.Now < m_endAt && m_threads.Any(t => !t.Completed))
            {
                Thread.Sleep(1000);
            }
            m_threads.ForEach(t => t.Abort());
        }
 public TestListenerAdapter(IPerformanceTestRunnerListener listener, PerformanceSuite.PerfTestContext ctxt)
 {
     m_listener = listener;
     m_agentId = ctxt.AgentId;
     m_machineId = ctxt.MachineId;
 }
Exemple #5
0
 public TestListenerAdapter(IPerformanceTestRunnerListener listener, PerformanceSuite.PerfTestContext ctxt)
 {
     m_listener  = listener;
     m_agentId   = ctxt.AgentId;
     m_machineId = ctxt.MachineId;
 }
Exemple #6
0
        private IEnumerable <Action> TestsToParallelActions(IList <IPerformanceTest> tests, IPerformanceTestRunnerListener listener)
        {
            //barrier to synchronize Before/After operations
            var testSynchronizationBarrier = new Barrier(tests.Count);
            var actions = tests.Select(test => TestToAction(test, testSynchronizationBarrier, listener)).ToList();

            return(actions);
        }
Exemple #7
0
        public void Start(PerformanceSuite.PerfTestContext ctxt, IPerformanceTestRunnerListener runListener)
        {
            var actions = TestsToParallelActions(m_tests, runListener);

            ParallelActionInvoker.InvokeAllWaitingForCompletion(actions, m_runTimeout, m_threadPriority);
        }
 public Builder Listener(IPerformanceTestRunnerListener listener)
 {
     m_listener = listener;
     return(this);
 }