public ConcurrentTestStepWrapper(BizUnitTestStepWrapper stepWrapper, Context ctx )
		{
            StepWrapper = stepWrapper;
            // TODO:.... ILogger
            _logger = new Logger();
		    _logger.ConcurrentExecutionMode = true;
            _context = ctx.CloneForConcurrentUse(_logger);
        }
Exemple #2
0
        private void AddTestStepInternal(BizUnitTestStepWrapper stepWrapper, TestStage stage)
        {
            switch (stage)
            {
            case TestStage.Setup:
                _setupSteps.Add(stepWrapper);
                break;

            case TestStage.Execution:
                _executionSteps.Add(stepWrapper);
                break;

            case TestStage.Cleanup:
                _cleanupSteps.Add(stepWrapper);
                break;
            }
        }
Exemple #3
0
 private void AddTestStepInternal(BizUnitTestStepWrapper stepWrapper, TestStage stage)
 {
     switch (stage)
     {
         case TestStage.Setup:
             _setupSteps.Add(stepWrapper);
             break;
         case TestStage.Execution:
             _executionSteps.Add(stepWrapper);
             break;
         case TestStage.Cleanup:
             _cleanupSteps.Add(stepWrapper);
             break;
     }
 }
Exemple #4
0
        private void ExecuteTestStep(BizUnitTestStepWrapper stepWrapper, TestStage stage)
        {
            try
            {
                // Should this step be executed concurrently?
                if (stepWrapper.RunConcurrently)
                {
                    _logger.TestStepStart(stepWrapper.TypeName, DateTime.Now, true, stepWrapper.FailOnError);
                    Interlocked.Increment(ref _inflightQueueDepth);
                    ThreadPool.QueueUserWorkItem(new WaitCallback(WorkerThreadThunk), new ConcurrentTestStepWrapper(stepWrapper, _context));
                }
                else
                {
                    _logger.TestStepStart(stepWrapper.TypeName, DateTime.Now, false, stepWrapper.FailOnError);
                    stepWrapper.Execute(_context);
                }
            }
            catch (Exception e)
            {
                _logger.TestStepEnd(stepWrapper.TypeName, DateTime.Now, e);

                if (stepWrapper.FailOnError)
                {
                    if (e is ValidationStepExecutionException)
                    {
                        throw;
                    }
                    else
                    {
                        var tsee = new TestStepExecutionException("BizUnit encountered an error executing a test step", e, stage, _testName, stepWrapper.TypeName);
                        throw tsee;
                    }
                }
            }

            if (!stepWrapper.RunConcurrently)
            {
                _logger.TestStepEnd(stepWrapper.TypeName, DateTime.Now, null);
            }

            FlushConcurrentQueue(false, stage);
        }
Exemple #5
0
        private void ExecuteSteps(XmlNodeList steps, TestStage stage)
        {
            if (null == steps)
            {
                return;
            }

            foreach (XmlNode stepConfig in steps)
            {
                var stepWrapper = new BizUnitTestStepWrapper(stepConfig);
                ExecuteTestStep(stepWrapper, stage);
            }

            FlushConcurrentQueue(true, stage);
        }