private void ExecuteRepeatLastRunCommand(object parameter)
        {
            var tests = _model.LastRun.ToList();

            _model.ClearLastRun();

            Model.IsBusy = true;
            _testEngine.Run(tests);
            Model.IsBusy = false;
        }
Example #2
0
 protected override void OnExecute(object parameter)
 {
     if (_engine.CanRun)
     {
         _engine.Run(_engine.Tests);
     }
 }
Example #3
0
        private void RunTests()
        {
            _model.TestsRefreshed -= TestsRefreshed;

            var stopwatch = new Stopwatch();

            _model.ClearLastRun();
            _model.IsBusy = true;

            _presenter?.Show();

            stopwatch.Start();
            try
            {
                _engine.Run(_model.Tests);
            }
            finally
            {
                stopwatch.Stop();
                _model.IsBusy = false;
            }

            Logger.Info($"Test run completed in {stopwatch.ElapsedMilliseconds}.");
            OnRunCompleted(new TestRunEventArgs(stopwatch.ElapsedMilliseconds));
        }
 public void RunTests(IEnumerable <TestMethod> tests)
 {
     Control.ClearResults();
     Control.SetPlayList(tests);
     Control.ClearProgress();
     _testEngine.Run(tests);
 }
Example #5
0
 public override void Execute(object parameter)
 {
     _model.Refresh();
     _model.ClearLastRun();
     _model.IsBusy = true;
     _engine.Run(_model.Tests);
     _model.IsBusy = false;
 }
Example #6
0
        private void ExecuteRepeatLastRunCommand(object parameter)
        {
            var tests = _model.LastRun.ToList();

            _model.ClearLastRun();

            var stopwatch = new Stopwatch();

            Model.IsBusy = true;

            stopwatch.Start();
            _testEngine.Run(tests);
            stopwatch.Stop();

            Model.IsBusy  = false;
            TotalDuration = stopwatch.ElapsedMilliseconds;
        }
        private int RunTests(TestPackage package, TestFilter filter)
        {
            // TODO: We really need options as resolved by engine for most of  these
            DisplayRequestedOptions();

            // TODO: Incorporate this in EventCollector?
            RedirectOutputAsRequested();

            TestEventHandler eventHandler = new TestEventHandler(options, outWriter, errorWriter);

            XmlNode result = null;

            // Save things that might be messed up by a bad test
            TextWriter savedOut   = Console.Out;
            TextWriter savedError = Console.Error;

            DateTime startTime = DateTime.Now;

            try
            {
                using (new ColorConsole(ColorStyle.Output))
#if true
                    result = engine.Run(package, eventHandler, filter);
#else
                    using (ITestRunner runner = engine.GetRunner(package))
                    {
                        if (runner.Load(package))
                        {
                            engineResult = runner.Run(eventHandler, testFilter);
                        }
                    }
#endif
            }
            finally
            {
                Console.SetOut(savedOut);
                Console.SetError(savedError);

                RestoreOutput();
            }

            //Console.WriteLine();

            ResultReporter reporter = new ResultReporter(result, options);
            reporter.ReportResults();

            // TODO: Inject this?
            var outputManager = new OutputManager(result, this.workDirectory);

            foreach (var outputSpec in options.ResultOutputSpecifications)
            {
                outputManager.WriteResultFile(outputSpec, startTime);
            }

            return(reporter.Summary.ErrorsAndFailures);
        }
        protected override void OnExecute(object parameter)
        {
            if (!((parameter ?? FindDeclarationFromSelection()) is Declaration candidate) ||
                !(_engine.Tests.FirstOrDefault(test => test.Declaration.Equals(candidate)) is TestMethod selectedTest) ||
                !_engine.CanRun)
            {
                return;
            }

            _engine.Run(new [] { selectedTest });
        }
        private void RunTests()
        {
            _model.TestsRefreshed -= TestsRefreshed;

            var stopwatch = new Stopwatch();

            _model.ClearLastRun();
            _model.IsBusy = true;

            stopwatch.Start();
            _engine.Run(_model.Tests);
            stopwatch.Stop();

            _model.IsBusy = false;

            OnRunCompleted(new TestRunEventArgs(stopwatch.ElapsedMilliseconds));
        }
        protected override void OnExecute(object parameter)
        {
            if (!((parameter ?? FindModuleFromSelection()) is Declaration candidate) ||
                candidate.DeclarationType != DeclarationType.ProceduralModule ||
                !candidate.Annotations.Any(annotation => annotation is TestModuleAnnotation) ||
                !_engine.CanRun)
            {
                return;
            }

            var tests = _engine.Tests.Where(test => test.Declaration.QualifiedModuleName.Equals(candidate.QualifiedModuleName)).ToList();

            if (!tests.Any())
            {
                return;
            }

            _engine.Run(tests);
        }
        public void RunTests(IEnumerable <TestMethod> tests)
        {
            _view.ClearResults();

            var testMethods = tests as IList <TestMethod> ?? tests.ToList(); //bypasses multiple enumeration

            _view.SetPlayList(testMethods);

            _view.ClearProgress();

            var projects = testMethods.Select(t => t.QualifiedMemberName.QualifiedModuleName.Project).Distinct();

            foreach (var project in projects)
            {
                project.EnsureReferenceToAddInLibrary();
            }

            _testEngine.Run(testMethods);
        }
Example #12
0
        private void StateChanged(object sender, ParserStateEventArgs e)
        {
            if (e.State != ParserState.Ready)
            {
                return;
            }

            var stopwatch = new Stopwatch();

            _model.ClearLastRun();
            _model.IsBusy = true;

            stopwatch.Start();
            _engine.Run(_model.Tests);
            stopwatch.Stop();

            _model.IsBusy        = false;
            _state.StateChanged -= StateChanged;

            OnRunCompleted(new TestRunEventArgs(stopwatch.ElapsedMilliseconds));
        }
        private void ExecuteRepeatLastRunCommand(object parameter)
        {
            EnsureRubberduckIsReferencedForEarlyBoundTests();

            var tests = Model.LastRun.ToList();

            Model.ClearLastRun();

            var stopwatch = new Stopwatch();

            Model.IsBusy = true;

            stopwatch.Start();
            _testEngine.Run(tests);
            stopwatch.Stop();

            Model.IsBusy  = false;
            TotalDuration = stopwatch.ElapsedMilliseconds;
        }