protected override Task executeSteps(SpecContext context, IList <ILineExecution> lines, CancellationToken token)
        {
            _steps  = lines;
            Context = context;

            _observer.SendProgress(new SpecProgress(Context.Specification.id, Context.Counts, 0, _steps.Count));

            _executionObserver.SpecStarted(Request);

            if (Request.Mode == ExecutionMode.stepthrough)
            {
                sendNextStepMessage();
            }
            else if (Request.Mode == ExecutionMode.breakpoint)
            {
                RunToBreakpoint();
            }
            else
            {
                return(base.executeSteps(context, lines, token));
            }

            _hasStarted.SetResult(true);

            return(_completion.Task);
        }
Beispiel #2
0
        public void BeforeRunning(SpecExecutionRequest request)
        {
            var total    = request.Plan.Count();
            var starting = new SpecProgress(request.Id, new Counts(), 0, total);

            _observer.SendProgress(starting);
        }
Beispiel #3
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();
        }
        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();
        }
        public override void Line(ILineExecution execution)
        {
            base.Line(execution);

            var progress = new SpecProgress(_plan.Specification.id, CurrentContext.Counts.Clone(), ++_step, _total);

            _observer.SendProgress(progress);
        }
Beispiel #6
0
        public void Line(ILineExecution execution)
        {
            if (!_context.CanContinue())
            {
                return;
            }

            execution.Execute(_context);

            var progress = new SpecProgress(_plan.Specification.id, CurrentContext.Counts.Clone(), ++_step, _total);

            _observer.SendProgress(progress);
        }
Beispiel #7
0
        public void LineComplete(ISpecContext context, ILineExecution line)
        {
            var progress = new SpecProgress(context.Specification.id, context.Counts.Clone(), ++_step, _total);

            _observer.SendProgress(progress);
        }
Beispiel #8
0
 private void executeCurrentStep()
 {
     Current.Execute(_context);
     _observer.SendProgress(new SpecProgress(_request.Id, _context.Counts, _position + 1, _steps.Count));
 }