Example #1
0
        public DefaultRunner(ISpecificationRunListener listener, RunOptions options)
        {
            _listener       = listener;
            _options        = options;
            _assemblyRunner = new AssemblyRunner(_listener, _options);

            _explorer = new AssemblyExplorer();

            _runStart = () => _listener.OnRunStart();
            _runEnd   = () => _listener.OnRunEnd();
        }
    public DefaultRunner(ISpecificationRunListener listener, RunOptions options)
    {
      _listener = listener;
      _options = options;
      _assemblyRunner = new AssemblyRunner(_listener, _options);

      _explorer = new AssemblyExplorer();

      _runStart = () => _listener.OnRunStart();
      _runEnd = () => _listener.OnRunEnd();
    }
        public DefaultRunner(ISpecificationRunListener listener, RunOptions options, bool signalRunStartAndEnd)
        {
            _listener = listener;
            _options = options;
            _assemblyRunner = new AssemblyRunner(_listener, _options);

            _explorer = new AssemblyExplorer();

            if (signalRunStartAndEnd)
            {
                _runStart = new InvokeOnce(() => _listener.OnRunStart());
                _runEnd = new InvokeOnce(() => _listener.OnRunEnd());
            }
        }
        public DefaultRunner(ISpecificationRunListener listener, RunOptions options, bool signalRunStartAndEnd)
        {
            _listener       = listener;
            _options        = options;
            _assemblyRunner = new AssemblyRunner(_listener, _options);

            _explorer = new AssemblyExplorer();

            if (signalRunStartAndEnd)
            {
                _runStart = new InvokeOnce(() => _listener.OnRunStart());
                _runEnd   = new InvokeOnce(() => _listener.OnRunEnd());
            }
        }
Example #5
0
        private void OnListenEvent(string value)
        {
            using (var stringReader = new StringReader(value)) {
                XDocument doc     = XDocument.Load(stringReader);
                XElement  element = doc.XPathSelectElement("/listener/*");

                switch (element.Name.ToString())
                {
                case "onassemblystart":
                    _runListener.OnAssemblyStart(AssemblyInfo.Parse(element.XPathSelectElement("//onassemblystart/*").ToString()));
                    break;

                case "onassemblyend":
                    _runListener.OnAssemblyEnd(AssemblyInfo.Parse(element.XPathSelectElement("//onassemblyend/*").ToString()));
                    break;

                case "onrunstart":
                    _runListener.OnRunStart();
                    break;

                case "onrunend":
                    _runListener.OnRunEnd();
                    break;

                case "oncontextstart":
                    _runListener.OnContextStart(ContextInfo.Parse(element.XPathSelectElement("//oncontextstart/*").ToString()));
                    break;

                case "oncontextend":
                    _runListener.OnContextEnd(ContextInfo.Parse(element.XPathSelectElement("//oncontextend/*").ToString()));
                    break;

                case "onspecificationstart":
                    _runListener.OnSpecificationStart(SpecificationInfo.Parse(element.XPathSelectElement("//onspecificationstart/*").ToString()));
                    break;

                case "onspecificationend":
                    _runListener.OnSpecificationEnd(
                        SpecificationInfo.Parse(element.XPathSelectElement("//onspecificationend/specificationinfo").ToString()),
                        Result.Parse(element.XPathSelectElement("//onspecificationend/result").ToString()));
                    break;

                case "onfatalerror":
                    _runListener.OnFatalError(ExceptionResult.Parse(element.XPathSelectElement("//onfatalerror/*").ToString()));
                    break;
                }
            }
        }
        public static void Run(this ISpecificationRunListener adapter, AssemblyInfo assemblyInfo,
                               SpecificationInfo specificationInfo, Result failure, ExceptionResult exceptionResult,
                               ContextInfo contexInfo)
        {
            adapter.OnAssemblyStart(assemblyInfo);
            adapter.OnAssemblyEnd(assemblyInfo);

            adapter.OnSpecificationStart(specificationInfo);
            adapter.OnSpecificationEnd(specificationInfo, failure);

            adapter.OnFatalError(exceptionResult);

            adapter.OnContextStart(contexInfo);
            adapter.OnContextEnd(contexInfo);

            adapter.OnRunStart();
            adapter.OnRunEnd();
        }
Example #7
0
        void StartRun(IDictionary <Assembly, IEnumerable <Context> > contextMap)
        {
            _listener.OnRunStart();

            foreach (var pair in contextMap)
            {
                var assembly = pair.Key;
                // TODO: move this filtering to a more sensible place
                var contexts = pair.Value.FilteredBy(_options);

                if (contexts.Any())
                {
                    StartAssemblyRun(assembly, contexts);
                }
            }

            _listener.OnRunEnd();
        }
        protected override TestResult RunImpl(ITestCommand rootTestCommand, TestStep parentTestStep,
                                              TestExecutionOptions options, IProgressMonitor progressMonitor)
        {
            using (progressMonitor)
            {
                progressMonitor.BeginTask("Verifying Specifications", rootTestCommand.TestCount);

                if (options.SkipTestExecution)
                {
                    return(SkipAll(rootTestCommand, parentTestStep));
                }
                else
                {
                    ITestContext rootContext = rootTestCommand.StartPrimaryChildStep(parentTestStep);
                    TestStep     rootStep    = rootContext.TestStep;
                    TestOutcome  outcome     = TestOutcome.Passed;

                    _progressMonitor = progressMonitor;
                    SetupRunOptions(options);
                    SetupListeners(options);

                    _listener.OnRunStart();

                    foreach (ITestCommand command in rootTestCommand.Children)
                    {
                        MachineAssemblyTest assemblyTest = command.Test as MachineAssemblyTest;
                        if (assemblyTest == null)
                        {
                            continue;
                        }

                        var assemblyResult = RunAssembly(assemblyTest, command, rootStep);
                        outcome = outcome.CombineWith(assemblyResult.Outcome);
                    }

                    _listener.OnRunEnd();

                    return(rootContext.FinishStep(outcome, null));
                }
            }
        }
Example #9
0
 public void OnRunEnd()
 {
     runListener.OnRunEnd();
 }
Example #10
0
 public void EndRun()
 {
     listener.OnRunEnd();
 }
 public void OnRunEnd()
 {
     _listener.OnRunEnd();
 }
Example #12
0
 public void EndRun(Assembly assembly)
 {
     _assemblyRunner.EndExplicitRunScope(assembly);
     _listener.OnRunEnd();
 }
Example #13
0
 public virtual void OnRunEnd()
 {
     _runListener.OnRunEnd();
 }