示例#1
0
        public SpecResults Execute(Specification specification)
        {
            var plan    = specification.CreatePlan(_library);
            var timings = new Timings();

            _warmup.Wait(1.Minutes());

            timings.Start(specification);

            IExecutionContext execution = null;
            SpecContext       context   = null;

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

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

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

                SpecExecution.RunAll(context, plan);
            }
            finally
            {
                execution?.Dispose();
                context?.Dispose();
            }


            return(context.FinalizeResults(1));
        }
        // TODO -- if an error bubbles up, the SpecificationEngine should mark its runner
        //         as Invalid
        public static StepthroughExecutor Start(ISystem system, Specification specification, IResultObserver observer, IUserInterfaceObserver uiObserver, FixtureLibrary library)
        {
            var request = new SpecExecutionRequest(specification, observer);
            request.CreatePlan(library);

            // Got to watch because this can error out
            var execution = system.CreateContext();

            return new StepthroughExecutor(execution, request, uiObserver);
        }
示例#3
0
        // TODO -- if an error bubbles up, the SpecificationEngine should mark its runner
        //         as Invalid
        public static StepthroughExecutor Start(ISystem system, Specification specification, IResultObserver observer, IUserInterfaceObserver uiObserver, FixtureLibrary library)
        {
            var request = new SpecExecutionRequest(specification, observer);

            request.CreatePlan(library);

            // Got to watch because this can error out
            var execution = system.CreateContext();

            return(new StepthroughExecutor(execution, request, uiObserver));
        }
        private IExecutionContext createExecutionContext(ISystem system, Timings timings)
        {
            var record = timings.Subject("Context", "Creation", 0);

            try
            {
                return(system.CreateContext());
            }
            catch (Exception e)
            {
                Request.Cancel();

                throw new StorytellerExecutionException(e);
            }
            finally
            {
                timings.End(record);
            }
        }
示例#5
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();
        }
示例#6
0
        private IExecutionContext createExecutionContext(ISystem system, Timings timings)
        {
            try
            {
                using (timings.Subject("Context", "Creation"))
                {
                    return system.CreateContext();
                }
            }
            catch (Exception e)
            {
                Request.Cancel();

                throw new StorytellerExecutionException(e);
            }
        }
示例#7
0
        public IExecutionContext CreateContext()
        {
            var inner = _inner.CreateContext();

            return(new CompositeExecutionContext(inner, _handling.Extensions));
        }