public void CheckStateAfterRunningTests() { _model.RunAllTests(); Assert.That(_model.HasTests, "HasTests"); Assert.NotNull(_model.Tests, "Tests"); Assert.False(_model.HasResults, "HasResults"); }
private void MainForm_Load(object sender, System.EventArgs e) { var location = _settings.Gui.MainForm.Location; var size = _settings.Gui.MainForm.Size; if (size == Size.Empty) { size = _view.Size; } if (size.Width < 160) { size.Width = 160; } if (size.Height < 32) { size.Height = 32; } if (!IsVisiblePosition(location, size)) { location = new Point(0, 0); } _view.Location = location; _view.Size = size; // Set to maximized if required if (_settings.Gui.MainForm.Maximized) { _view.IsMaximized = true; } // Set the font to use _view.Font = _settings.Gui.MainForm.Font; if (_options.InternalTraceLevel != null) { _model.PackageSettings.Add(EnginePackageSettings.InternalTraceLevel, _options.InternalTraceLevel); } //_model.OnStartup(); if (_options.InputFiles.Count > 0) { _model.LoadTests(_options.InputFiles); } else if (!_options.NoLoad && _model.Services.RecentFiles.Entries.Count > 0) { var entry = _model.Services.RecentFiles.Entries[0]; if (!string.IsNullOrEmpty(entry) && System.IO.File.Exists(entry)) { _model.LoadTests(new[] { entry }); } } if (_options.RunAllTests && _model.IsPackageLoaded) { _model.RunAllTests(); } }
private void RunAllTests() { if (_model.Services.UserSettings.Engine.ReloadOnRun) { _model.ReloadTests(); } _model.RunAllTests(); }
private void RunAllTestsAndWaitForCompletion() { bool runComplete = false; _model.Events.RunFinished += (r) => runComplete = true; _model.RunAllTests(); while (!runComplete) { System.Threading.Thread.Sleep(1); } }
public void RunAllTests() { _model.ClearResults(); _model.RunAllTests(); }
private void WireUpEvents() { // Model actions _model.TestLoaded += (ea) => { _strategy.OnTestLoaded(ea.Test); InitializeRunCommands(); InitializeCategories(ea.Categories); _view.ShowCheckBoxesCommand.Checked = Settings.ShowCheckboxes; }; _model.TestReloaded += (ea) => { _strategy.OnTestLoaded(ea.Test); InitializeRunCommands(); ApplyCategoryFilter(_view.Category.SelectedCategories.Items, _view.Category.ExcludeCommand.Checked); }; _model.TestUnloaded += (ea) => { _strategy.OnTestUnloaded(); InitializeRunCommands(); }; _model.RunStarting += (ea) => InitializeRunCommands(); _model.RunFinished += (ea) => InitializeRunCommands(); _model.TestFinished += (ea) => _strategy.OnTestFinished(ea.Result); _model.SuiteFinished += (ea) => _strategy.OnTestFinished(ea.Result); // View actions - Initial Load _view.Load += (s, e) => SetDefaultDisplayStrategy(); // View context commands _view.Tree.ContextMenu.Popup += () => _view.RunCheckedCommand.Visible = _view.Tree.CheckBoxes && _view.Tree.CheckedNodes.Count > 0; _view.CollapseAllCommand.Execute += () => _view.CollapseAll(); _view.ExpandAllCommand.Execute += () => _view.ExpandAll(); _view.CollapseToFixturesCommand.Execute += () => _strategy.CollapseToFixtures(); _view.ShowCheckBoxesCommand.CheckedChanged += () => { _view.RunSelectedCommand.Enabled = false; _view.Tree.CheckBoxes = _view.CheckAllTestsCommand.Visible = _view.UncheckAllTestsCommand.Visible = _view.CheckFailedTestsCommand.Visible = Settings.ShowCheckboxes = _view.ShowCheckBoxesCommand.Checked; }; _view.CheckAllTestsCommand.Execute += () => { var treeView = _view.Tree?.Control; if (treeView != null) { ToggleNodeCheck(treeView.Nodes, true, true); } }; _view.UncheckAllTestsCommand.Execute += () => { var treeView = _view.Tree?.Control; if (treeView != null) { ToggleNodeCheck(treeView.Nodes, false, true); } }; _view.CheckFailedTestsCommand.Execute += () => { var treeView = _view.Tree?.Control; if (treeView != null) { ToggleNodeCheck(_strategy.GetFailedNodes(), true, true); } }; _view.RunContextCommand.Execute += () => _model.RunTests(_selectedTestItem); _view.RunCheckedCommand.Execute += RunCheckedTests; // Node selected in tree _view.Tree.SelectedNodeChanged += (tn) => { _selectedTestItem = tn.Tag as ITestItem; _view.RunContextCommand.Enabled = (_selectedTestItem as TestNode)?.CanRun() ?? true; _model.NotifySelectedItemChanged(_selectedTestItem); }; // Run button and dropdowns _view.RunButton.Execute += () => _model.RunAllTests(); _view.RunAllCommand.Execute += () => _model.RunAllTests(); _view.RunSelectedCommand.Execute += () => _model.RunTests(_selectedTestItem); _view.RunFailedCommand.Execute += () => RunFailedTest(); _view.StopRunCommand.Execute += () => _model.CancelTestRun(); // Change of display format _view.DisplayFormat.SelectionChanged += () => { SetDisplayStrategy(_view.DisplayFormat.SelectedItem); _strategy.Reload(); ApplyCategoryFilter(_view.Category.SelectedCategories.Items, _view.Category.ExcludeCommand.Checked); }; _view.Category.SelectedCategories.ItemsChanged += (sender, ae) => ApplyCategoryFilter(ae.Value, _view.Category.ExcludeCommand.Checked); _view.Category.ExcludeCommand.CheckedChanged += () => ApplyCategoryFilter(_view.Category.SelectedCategories.Items, _view.Category.ExcludeCommand.Checked); }
private void MainForm_Load(object sender, System.EventArgs e) { var location = _settings.Gui.MainForm.Location; var size = _settings.Gui.MainForm.Size; if (size == Size.Empty) { size = _view.Size; } if (size.Width < 160) { size.Width = 160; } if (size.Height < 32) { size.Height = 32; } if (!IsVisiblePosition(location, size)) { location = new Point(0, 0); } _view.Location = location; _view.Size = size; // Set to maximized if required if (_settings.Gui.MainForm.Maximized) { _view.IsMaximized = true; } // Set the font to use _view.Font = _settings.Gui.Font; var settings = _model.PackageOverrides; if (_options.InternalTraceLevel != null) { settings.Add(EnginePackageSettings.InternalTraceLevel, _options.InternalTraceLevel); } if (_options.MaxAgents >= 0) { _model.Settings.Engine.Agents = _options.MaxAgents; } _view.RunAsX86.Checked = _options.RunAsX86; if (_options.InputFiles.Count > 0) { _model.LoadTests(_options.InputFiles); } else if (!_options.NoLoad && _model.RecentFiles.Entries.Count > 0) { var entry = _model.RecentFiles.Entries[0]; if (!string.IsNullOrEmpty(entry) && System.IO.File.Exists(entry)) { _model.LoadTests(new[] { entry }); } } if (_options.RunAllTests && _model.IsPackageLoaded) { _model.RunAllTests(); } // Currently, --unattended without --run does nothing except exit. else if (_options.Unattended) { _view.Close(); } }
private void WireUpEvents() { // Model actions _model.Events.TestLoaded += (ea) => { _strategy.OnTestLoaded(ea.Test); InitializeRunCommands(); }; _model.Events.TestReloaded += (ea) => { _strategy.OnTestLoaded(ea.Test); InitializeRunCommands(); }; _model.Events.TestUnloaded += (ea) => { _strategy.OnTestUnloaded(); InitializeRunCommands(); }; _model.Events.RunStarting += (ea) => InitializeRunCommands(); _model.Events.RunFinished += (ea) => InitializeRunCommands(); _model.Events.TestFinished += (ea) => _strategy.OnTestFinished(ea.Result); _model.Events.SuiteFinished += (ea) => _strategy.OnTestFinished(ea.Result); // View actions - Initial Load _view.Load += (s, e) => { SetDefaultDisplayStrategy(); }; // View context commands _view.Tree.ContextMenu.Popup += () => _view.RunCheckedCommand.Visible = _view.Tree.CheckBoxes && _view.Tree.CheckedNodes.Count > 0; _view.CollapseAllCommand.Execute += () => _view.CollapseAll(); _view.ExpandAllCommand.Execute += () => _view.ExpandAll(); _view.CollapseToFixturesCommand.Execute += () => _strategy.CollapseToFixtures(); _view.ShowCheckBoxes.CheckedChanged += () => _view.Tree.CheckBoxes = _view.ShowCheckBoxes.Checked;; _view.RunContextCommand.Execute += () => { if (_selectedTestItem != null) { _model.RunTests(_selectedTestItem); } }; _view.RunCheckedCommand.Execute += RunCheckedTests; // Node selected in tree _view.Tree.SelectedNodeChanged += (tn) => { _selectedTestItem = tn.Tag as ITestItem; _model.NotifySelectedItemChanged(_selectedTestItem); }; // Run button and dropdowns _view.RunButton.Execute += () => { // Necessary test because we don't disable the button click if (_model.HasTests && !_model.IsTestRunning) { _model.RunAllTests(); } }; _view.RunAllCommand.Execute += () => _model.RunAllTests(); _view.RunSelectedCommand.Execute += () => _model.RunTests(_selectedTestItem); _view.RunFailedCommand.Execute += () => _model.RunAllTests(); // NYI _view.StopRunCommand.Execute += () => _model.CancelTestRun(); // Change of display format _view.DisplayFormat.SelectionChanged += () => { SetDisplayStrategy(_view.DisplayFormat.SelectedItem); _strategy.Reload(); }; }