예제 #1
0
 public void AfterExecution(ISpecContext context)
 {
     _inner.AfterExecution(context);
     foreach (var extension in _extensions)
     {
         extension.AfterEach(context);
     }
 }
예제 #2
0
        private void finish()
        {
            _execution.AfterExecution(_context);
            _request.SpecExecutionFinished(_context.FinalizeResults(1));


            _context.SafeDispose();
            _execution.SafeDispose();
            _reset.Set();
        }
예제 #3
0
        public SpecResults Run(Specification specification)
        {
            var plan    = specification.CreatePlan(_running.Fixtures);
            var timings = new Timings();

            _warmup.Wait(1.Minutes());

            timings.Start(specification);

            IExecutionContext execution = null;
            SpecContext       context   = null;

            try
            {
                using (timings.Record("Context", "Creation"))
                {
                    execution = _running.System.CreateContext();
                }

                context = new SpecContext(specification, timings, new NulloResultObserver(), StopConditions,
                                          execution);

                execution.BeforeExecution(context);

                context.Reporting.As <Reporting>().StartDebugListening();

                SpecExecution.RunAll(context, plan);

                execution.AfterExecution(context);
            }
            finally
            {
                execution?.Dispose();
                context?.Dispose();
            }

            var results = context.FinalizeResults(1);

            _records.Add(new BatchRecord
            {
                results       = results,
                specification = specification
            });

            return(results);
        }
예제 #4
0
        private void execute()
        {
            try
            {
                using (_timings.Subject("Context", "Creation"))
                {
                    _execution = _system.CreateContext();
                }
            }
            catch (Exception e)
            {
                _catastrophicException = e;
                _reset.Set();

                return;
            }

            if (_request.IsCancelled)
            {
                return;
            }

            _context = new SpecContext(_request.Specification, _timings, _request.Observer, _stopConditions, _execution);

            try
            {
                _execution.BeforeExecution(_context);
            }
            catch (Exception e)
            {
                _context.LogException(_request.Id, e, "BeforeExecution");
            }

            _context.Reporting.As <Reporting>().StartDebugListening();
            var executor = _mode.BuildExecutor(_request.Plan, _context);

            _request.Plan.AcceptVisitor(executor);

            _execution.AfterExecution(_context);

            _reset.Set();
        }
예제 #5
0
        private void execute(EventWaitHandle reset)
        {
            try
            {
                using (_timings.Subject("Context", "Creation"))
                {
                    _execution = _system.CreateContext();
                }
            }
            catch (Exception e)
            {
                _catastrophicException = e;
                reset.Set();

                return;
            }

            if (_request.IsCancelled) return;

            _context = new SpecContext(_request.Specification, _timings, _request.Observer, _stopConditions, _execution);
            try
            {
                _execution.BeforeExecution(_context);
            }
            catch (Exception e)
            {
                _context.LogException(_request.Id, e, "BeforeExecution");
            }

            _context.Reporting.As<Reporting>().StartDebugListening();
            var executor = _mode.BuildExecutor(_request.Plan, _context);

            _request.Plan.AcceptVisitor(executor);

            _execution.AfterExecution(_context);

            reset.Set();
        }