Ejemplo n.º 1
0
        public StepthroughExecutor(IExecutionContext execution, SpecExecutionRequest request, IUserInterfaceObserver observer)
        {
            _context = new SpecContext(request.Specification, new Timings(), request.Observer, new StopConditions(), execution);

            _execution = execution;
            _request   = request;
            _observer  = observer;
            var gatherer = new ExecutionStepGatherer(_context);

            _request.Plan.AcceptVisitor(gatherer);

            _steps = gatherer.Lines;


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

            _observer.SendProgress(new SpecProgress(_request.Id, _context.Counts, 0, _steps.Count));
            sendNextStepMessage();
        }
Ejemplo n.º 2
0
        public StepthroughExecutor(IExecutionContext execution, SpecExecutionRequest request, IUserInterfaceObserver observer)
        {
            _context = new SpecContext(request.Specification, new Timings(), request.Observer, new StopConditions(), execution);

            _execution = execution;
            _request = request;
            _observer = observer;
            var gatherer = new ExecutionStepGatherer(_context);
            _request.Plan.AcceptVisitor(gatherer);

            _steps = gatherer.Lines;


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

            _observer.SendProgress(new SpecProgress(_request.Id, _context.Counts, 0, _steps.Count));
            sendNextStepMessage();
        }
Ejemplo n.º 3
0
 public void BeforeExecution(ISpecContext context)
 {
     _inner.BeforeExecution(context);
     foreach (var extension in _extensions)
     {
         extension.BeforeEach(context);
     }
 }
 private void beforeExecution(IExecutionContext execution, SpecContext context)
 {
     try
     {
         execution.BeforeExecution(context);
     }
     catch (Exception e)
     {
         context.LogException(Request.Id, e, null, "BeforeExecution");
     }
 }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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();
        }
Ejemplo n.º 7
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();
        }
Ejemplo n.º 8
0
 private void beforeExecution(IExecutionContext execution, SpecContext context)
 {
     try
     {
         execution.BeforeExecution(context);
     }
     catch (Exception e)
     {
         context.LogException(Request.Id, e, "BeforeExecution");
     }
 }