public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle testExecutionRecorder) { launcher = new TestLauncher(); foreach (var source in sources) { launcher.AddFilePattern(source); } RunTests(runContext, testExecutionRecorder); }
public void IgnoreTest() { string path = RootPath + @"/TestClasses/ClassLibrary5/bin/Debug/"; List <TestInfo> infoList = TestLauncher.Launch(path); Assert.IsTrue(infoList.Count == 2); foreach (var test in infoList) { Assert.IsFalse(test.Successfull); } }
public void Given_Match_WholeWord_And_Case_And_Hello_World_Returns_Row() { _containerOps = TestLauncher.StartLocalCIRemoteContainer(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); Mouse.Click(UIMap.MainStudioWindow.SideMenuBar.SearchButton, new Point(16, 11)); Mouse.Click(SearchUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.SearchTab.SearchConnectControlCustom.ServerComboBox.ServersToggleButton); Mouse.Click(SearchUIMap.MainStudioWindow.ComboboxItemAsRemoteConnectionIntegration); SearchUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.SearchTab.SearchOptionsExpander.ServiceCheckBox.Checked = true; SearchUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.SearchTab.MatchcaseCheckBox.Checked = true; SearchUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.SearchTab.MatchwholewordCheckBox.Checked = true; SearchUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.SearchTab.SearchInputEdit.Text = "Hello World"; Mouse.Click(SearchUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.SearchTab.SearchButton); Assert.IsTrue(UIMap.ControlExistsNow(SearchUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.SearchTab.WorkSurfaceContent.ContentDockManager.SearchViewUserControl.SearchResultsTable.ResultRow1), "Expected at least 1 Row, but got 0 Rows."); }
public void RunTests(IEnumerable <TestCase> tests, IRunContext runContext, IFrameworkHandle testExecutionRecorder) { launcher = new TestLauncher(); foreach (var test in tests) { launcher.AddFilePattern(test.Source); } SetTestFilter(tests); RunTests(runContext, testExecutionRecorder); }
public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle testExecutionRecorder) { launcher = new TestLauncher(); foreach (var test in tests) { launcher.AddFilePattern(test.Source); } SetTestFilter(tests); RunTests(runContext, testExecutionRecorder); }
public void ThenITypeHostAs(string hostname) { if (hostname == "test-rabbitmq") { _containerOps = TestLauncher.StartLocalRabbitMQContainer(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); } var manageRabbitMqSourceControl = ScenarioContext.Current.Get <ManageRabbitMQSourceControl>(Utils.ViewNameKey); manageRabbitMqSourceControl.EnterHostName(hostname); var viewModel = ScenarioContext.Current.Get <ManageRabbitMQSourceViewModel>("viewModel"); Assert.AreEqual(hostname, viewModel.HostName); }
private void AddAssemblies(TestLauncher launcher) { if (Files != null) { foreach (FileSet fs in Files) { foreach (string f in fs.FileNames) { launcher.AddFilePattern(f); } } } }
private void AddPluginDirectories(TestLauncher launcher) { if (PluginDirectories != null) { foreach (DirSet ds in PluginDirectories) { foreach (string d in ds.DirectoryNames) { launcher.RuntimeSetup.AddPluginDirectory(d); } } } }
private void AddHintDirectories(TestLauncher launcher) { if (HintDirectories != null) { foreach (DirSet ds in HintDirectories) { foreach (string d in ds.DirectoryNames) { launcher.TestProject.TestPackage.AddHintDirectory(new DirectoryInfo(d)); } } } }
public void RabbitMQConsumeTool_Small_And_LargeView_Then_NewSource_UITest() { using (ContainerLauncher RabbitMQContainer = TestLauncher.StartLocalRabbitMQContainer(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults"))) { Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.Exists, "RabbitMQ Consume Tool does not exist on the design surface."); //Small View Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.SmallViewContentCustom.SourceComboBox.Exists, "Source ComboBox does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.SmallViewContentCustom.EditSourceButton.Exists, "EditSource Button does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.SmallViewContentCustom.NewSourceButton.Exists, "NewSource Button does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.SmallViewContentCustom.QueueNameComboBox.Exists, "QueueName ComboBox does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.SmallViewContentCustom.ResponseComboBox.Exists, "Response ComboBox does not exist on the design surface."); //Large View UtilityToolsUIMap.Open_RabbitMqConsume_LargeView(); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.SourceComboBox.Exists, "Source ComboBox does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.EditSourceButton.Exists, "EditSource Button does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.NewSourceButton.Exists, "NewSource Button does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.QueueNameComboBox.Exists, "QueueName ComboBox does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.ResponseComboBox.Exists, "Response ComboBox does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.PrefetchComboBox.Exists, "Prefetch ComboBox does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.TimeOutComboBox.Exists, "Timeout ComboBox does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.AcknowledgeCheckBox.Exists, "Acknowledge Checkbox does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.ReQueueCheckBox.Exists, "ReQueue Checkbox does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.ResultsComboBox.Exists, "Results ComboBox does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.OnErrorCustom.Exists, "OnError Pane does not exist on the design surface."); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.DoneButton.Exists, "Done Button does not exist on the design surface."); //New Source UtilityToolsUIMap.Click_NewSourceButton_From_RabbitMQConsumeTool(); Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.Exists, "RabbitMQ Source Tab does not exist"); Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.HostTextBoxEdit.Enabled, "Host Textbox is not enabled"); Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.PortTextBoxEdit.Enabled, "Port Textbox is not enabled"); Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.UserNameTextBoxEdit.Enabled, "Username Textbox is not enabled"); Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.PasswordTextBoxEdit.Enabled, "Password Textbox is not enabled"); Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.VirtualHostTextBoxEdit.Enabled, "Virtual Host Textbox is not enabled"); Assert.IsFalse(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.TestConnectionButton.Enabled, "Test Connection button is enabled"); RabbitMQSourceUIMap.Enter_Text_On_RabbitMQSourceTab(); Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.TestConnectionButton.Enabled, "Test Connection button is not enabled"); RabbitMQSourceUIMap.Click_RabbitMQSource_TestConnectionButton(); Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.ItemImage.Exists, "Test Connection successful image does not appear."); UIMap.WaitForControlEnabled(UIMap.MainStudioWindow.SideMenuBar.SaveButton); Assert.IsTrue(UIMap.MainStudioWindow.SideMenuBar.SaveButton.Enabled, "Save ribbon button is not enabled after successfully testing new source."); UIMap.Save_With_Ribbon_Button_And_Dialog(SourceName); RabbitMQSourceUIMap.Click_Close_RabbitMQSource_Tab_Button(); //Edit Source UtilityToolsUIMap.Open_RabbitMqConsume_LargeView(); UtilityToolsUIMap.Select_Source_From_RabbitMQConsumeTool(); Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.EditSourceButton.Enabled, "Edit Source Button is not enabled after selecting source."); UtilityToolsUIMap.Click_EditSourceButton_On_RabbitMQConsumeTool(); Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.Exists, "RabbitMQ Source Tab does not exist"); } }
//not picking up public void RunTests(IEnumerable <TestCase> tests, IRunContext runContext, ITestExecutionRecorder testExecutionRecorder) { _launcher = new TestLauncher(); _launcher.RuntimeSetup = new RuntimeSetup(); //_launcher.TestProject. foreach (var test in tests) { _launcher.AddFilePattern(test.Source); _launcher.TestExecutionOptions.FilterSet = FilterUtils.ParseTestFilterSet("ExactType:" + test.DisplayName); } RunTests(testExecutionRecorder); }
public void TwoClassesTest() { string path = RootPath + @"/TestClasses/ClassLibrary6/bin/Debug/"; List <TestInfo> infoList = TestLauncher.Launch(path); Assert.IsTrue(infoList.Count == 5); Assert.AreEqual(typeof(DivideByZeroException), infoList[0].Result); Assert.IsFalse(infoList[1].Successfull); Assert.IsTrue(infoList[2].isIgnored); Assert.IsTrue(infoList[3].Successfull); Assert.IsTrue(infoList[4].Successfull); }
public static int Main() { NativeConsole console = NativeConsole.Instance; var launcher = new TestLauncher { EchoResults = true, Logger = new FilteredLogger(new RichConsoleLogger(console), Verbosity.Normal), ProgressMonitorProvider = new RichConsoleProgressMonitorProvider(console), RuntimeSetup = new RuntimeSetup(), TestProject = { TestRunnerFactoryName = StandardTestRunnerFactoryNames.Local } }; string gallioBin = Environment.GetEnvironmentVariable(GallioBinEnvironmentVariable) ?? InstallationConfiguration.LoadFromRegistry().InstallationFolder; if (string.IsNullOrEmpty(gallioBin)) { Console.Error.WriteLine("Cannot find Gallio installation directory."); Console.Error.WriteLine("Specify it with \"{0}\" environment variable.", GallioBinEnvironmentVariable); return(1); } launcher.AddFilePattern(typeof(Driver).Assembly.Location); launcher.RuntimeSetup.AddPluginDirectory(gallioBin); TestLauncherResult result = launcher.Run(); ConsoleColor originalConsoleColor = console.ForegroundColor; console.ForegroundColor = result.ResultCode == ResultCode.Success ? ConsoleColor.DarkGreen : ConsoleColor.Red; console.WriteLine(); console.WriteLine(result.ResultSummary); console.WriteLine(); console.ForegroundColor = originalConsoleColor; if (result.ResultCode != ResultCode.Success && Debugger.IsAttached) { Debugger.Break(); } return(result.ResultCode); }
public static int Main() { NativeConsole console = NativeConsole.Instance; var launcher = new TestLauncher { EchoResults = true, Logger = new FilteredLogger(new RichConsoleLogger(console), Verbosity.Normal), ProgressMonitorProvider = new RichConsoleProgressMonitorProvider(console), RuntimeSetup = new RuntimeSetup(), TestProject = { TestRunnerFactoryName = StandardTestRunnerFactoryNames.Local } }; string gallioBin = Environment.GetEnvironmentVariable(GallioBinEnvironmentVariable) ?? InstallationConfiguration.LoadFromRegistry().InstallationFolder; if(string.IsNullOrEmpty(gallioBin)) { Console.Error.WriteLine("Cannot find Gallio installation directory."); Console.Error.WriteLine("Specify it with \"{0}\" environment variable.", GallioBinEnvironmentVariable); return 1; } launcher.AddFilePattern(typeof(Driver).Assembly.Location); launcher.RuntimeSetup.AddPluginDirectory(gallioBin); TestLauncherResult result = launcher.Run(); ConsoleColor originalConsoleColor = console.ForegroundColor; console.ForegroundColor = result.ResultCode == ResultCode.Success ? ConsoleColor.DarkGreen : ConsoleColor.Red; console.WriteLine(); console.WriteLine(result.ResultSummary); console.WriteLine(); console.ForegroundColor = originalConsoleColor; if (result.ResultCode != ResultCode.Success && Debugger.IsAttached) { Debugger.Break(); } return result.ResultCode; }
private int RunTests(ILogger logger) { logger.Log(LogSeverity.Debug, Arguments.ToString()); var launcher = new TestLauncher { Logger = logger, ProgressMonitorProvider = CreateProgressMonitorProvider() }; ConfigureLauncherFromArguments(launcher, Arguments); TestLauncherResult result = launcher.Run(); DisplayResultSummary(result); return(result.ResultCode); }
public void EditServerSource_LoadCorrectly() { _containerOps = TestLauncher.StartLocalCIRemoteContainer(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); const string ExistingSourceName = "ExistingUITestServerSource"; ExplorerUIMap.Select_Source_From_ExplorerContextMenu(ExistingSourceName); ServerSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.ServerSourceTab.WaitForControlReady(60000); Assert.IsTrue(ServerSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.ServerSourceTab.Exists, "Server Source Tab does not exist after clicking edit on an explorer server source context menu and waiting 1 minute (60000ms)."); ServerSourceUIMap.Select_Server_Authentication_User(); ServerSourceUIMap.Enter_RunAsUser_On_ServerSourceTab("WarewolfAdmin", "W@rEw0lf@dm1n"); ServerSourceUIMap.Click_Server_Source_Wizard_Test_Connection_Button_For_Valid_Server_Source(); UIMap.Click_Save_Ribbon_Button_With_No_Save_Dialog(); ServerSourceUIMap.Click_Close_Server_Source_Wizard_Tab_Button(); ExplorerUIMap.Select_Source_From_ExplorerContextMenu(ExistingSourceName); Assert.AreEqual("WarewolfAdmin", ServerSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.ServerSourceTab.WorkSurfaceContext.UsernameTextBox.Text, "The user name Texbox value is not set to Intergration Testet."); }
public void RefreshExplorerAfterConnectingToRemoteDoesNotRefreshLocalhost() { try { _containerOps = TestLauncher.TryStartLocalCIRemoteContainer(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); ExplorerUIMap.Collapse_Localhost(); ExplorerUIMap.Select_RemoteContainer_From_Explorer(); Mouse.Click(ExplorerUIMap.MainStudioWindow.DockManager.SplitPaneLeft.Explorer.ExplorerRefreshButton, new Point(10, 10)); Assert.IsFalse(ExplorerUIMap.MainStudioWindow.DockManager.SplitPaneLeft.Explorer.ExplorerTree.localhost.Spinner.TryGetClickablePoint(out Point point), "Localhost spinner is showing while refreshing remote."); ExplorerUIMap.Expand_Localhost(); } finally { ExplorerUIMap.Expand_Localhost(); _containerOps?.Dispose(); } }
public static void Run(TestLauncher build) { build.InstallServer(); build.CleanupServerStudio(); build.Startmywarewolfio(); if (String.IsNullOrEmpty(build.DomywarewolfioStart)) { build.StartServer(); if (String.IsNullOrEmpty(build.DoServerStart) && String.IsNullOrEmpty(build.DomywarewolfioStart)) { build.StartStudio(); } } Console.WriteLine("Press Enter to Shutdown."); Console.ReadKey(); build.CleanupServerStudio(); }
private void Launch(bool doNoRun) { MarkupStreamWriter logStreamWriter = TestLog.Default; var launcher = new TestLauncher(); launcher.TestProject.TestPackage = testPackage; launcher.Logger = new MarkupStreamLogger(logStreamWriter); launcher.TestExecutionOptions.FilterSet = new FilterSet <ITestDescriptor>(new OrFilter <ITestDescriptor>(filters)); launcher.TestProject.TestRunnerFactoryName = TestRunnerFactoryName; string reportDirectory = SpecialPathPolicy.For <SampleRunner>().GetTempDirectory().FullName; launcher.TestProject.ReportDirectory = reportDirectory; launcher.TestProject.ReportNameFormat = "SampleRunnerReport"; launcher.ReportFormatterOptions.AddProperty(@"SaveAttachmentContents", @"false"); launcher.AddReportFormat(@"Text"); // Disabled because the Xml can get really big and causes problems if the sample runner is used frequently. //launcher.AddReportFormat("Xml"); launcher.DoNotRun = doNoRun; GenericCollectionUtils.ForEach(testRunnerOptions.Properties, x => launcher.TestRunnerOptions.AddProperty(x.Key, x.Value)); using (logStreamWriter.BeginSection("Log Output")) result = launcher.Run(); using (logStreamWriter.BeginSection("Text Report")) { foreach (string reportPath in result.ReportDocumentPaths) { string extension = Path.GetExtension(reportPath); if (extension == ".txt") { logStreamWriter.WriteLine(File.ReadAllText(reportPath)); } else if (extension == ".xml") { logStreamWriter.Container.AttachXml(null, File.ReadAllText(reportPath)); } File.Delete(reportPath); } } }
public void SaveNewServerSource_GivenSourceName() { _containerOps = TestLauncher.StartLocalCIRemoteContainer(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); //Create Source ExplorerUIMap.Select_NewServerSource_From_ExplorerContextMenu(); ServerSourceUIMap.Select_http_From_Server_Source_Wizard_Address_Protocol_Dropdown(); ServerSourceUIMap.Enter_TextIntoAddress_On_ServerSourceTab("test-remotewarewolf"); ServerSourceUIMap.Select_Server_Authentication_User(); ServerSourceUIMap.Enter_RunAsUser_On_ServerSourceTab("WarewolfAdmin", "W@rEw0lf@dm1n"); Assert.IsTrue(ServerSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.ServerSourceTab.WorkSurfaceContext.NewServerSource.TestConnectionButton.Enabled, "Test Connection button not enabled"); ServerSourceUIMap.Click_Server_Source_Wizard_Test_Connection_Button_For_Valid_Server_Source(); //Save Source const string sourceName = "NewCodedUITestServerSource"; UIMap.Save_With_Ribbon_Button_And_Dialog(sourceName); ExplorerUIMap.Filter_Explorer(sourceName); Assert.IsTrue(ExplorerUIMap.MainStudioWindow.DockManager.SplitPaneLeft.Explorer.ExplorerTree.localhost.FirstItem.Exists, "Source did not save in the explorer UI."); }
public void ClickingSave_ThenPressEnter_SavesServerResource_AndClosesSaveDialog() { _containerOps = TestLauncher.StartLocalCIRemoteContainer(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); ExplorerUIMap.Select_NewServerSource_From_ExplorerContextMenu(); ServerSourceUIMap.Select_http_From_Server_Source_Wizard_Address_Protocol_Dropdown(); ServerSourceUIMap.Enter_TextIntoAddress_On_ServerSourceTab("test-remotewarewolf"); ServerSourceUIMap.Select_Server_Authentication_User(); ServerSourceUIMap.Enter_RunAsUser_On_ServerSourceTab("WarewolfAdmin", "W@rEw0lf@dm1n"); Assert.IsTrue(ServerSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.ServerSourceTab.WorkSurfaceContext.NewServerSource.TestConnectionButton.Enabled, "Test Connection button not enabled"); ServerSourceUIMap.Click_Server_Source_Wizard_Test_Connection_Button_For_Valid_Server_Source(); Mouse.Click(UIMap.MainStudioWindow.SideMenuBar.SaveButton); DialogsUIMap.Enter_Valid_Service_Name_Into_Save_Dialog("ClickSaveEnterSavesServerResource"); WorkflowTabUIMap.Enter_Using_Shortcut(); DialogsUIMap.SaveDialogWindow.WaitForControlCondition(control => !control.TryGetClickablePoint(out Point point), 60000); Assert.IsFalse(DialogsUIMap.SaveDialogWindow.Exists); }
public void TaskPassesDefaultArgumentsToLauncher() { TestLauncher launcher = new TestLauncher(); EchoArguments arguments = new EchoArguments(); EchoProgram.ConfigureLauncherFromArguments(launcher, arguments); Assert.IsFalse(launcher.DoNotRun); Assert.IsTrue(launcher.EchoResults); Assert.IsTrue(launcher.TestExecutionOptions.FilterSet.IsEmpty); Assert.AreEqual("Reports", launcher.TestProject.ReportDirectory); Assert.IsFalse(launcher.TestProject.IsReportDirectorySpecified); Assert.AreElementsEqual(new string[] { }, launcher.ReportFormats); Assert.AreEqual("test-report-{0}-{1}", launcher.TestProject.ReportNameFormat); Assert.IsFalse(launcher.TestProject.IsReportNameFormatSpecified); Assert.IsFalse(launcher.ShowReports); Assert.IsNull(launcher.RunTimeLimit); Assert.AreEqual(StandardTestRunnerFactoryNames.IsolatedProcess, launcher.TestProject.TestRunnerFactoryName); Assert.IsFalse(launcher.TestProject.IsTestRunnerFactoryNameSpecified); Assert.Count(0, launcher.TestProject.TestRunnerExtensions); Assert.AreElementsEqual(new string[] { }, launcher.TestProject.TestRunnerExtensionSpecifications); Assert.IsNull(launcher.RuntimeSetup.ConfigurationFilePath); Assert.IsNull(launcher.RuntimeSetup.RuntimePath); Assert.AreElementsEqual(new string[] { }, launcher.RuntimeSetup.PluginDirectories); Assert.AreElementsEqual(new string[] { }, from x in launcher.FilePatterns select x.ToString()); Assert.AreElementsEqual(new string[] { }, from x in launcher.TestProject.TestPackage.HintDirectories select x.ToString()); Assert.IsNull(launcher.TestProject.TestPackage.ApplicationBaseDirectory); Assert.IsFalse(launcher.TestProject.TestPackage.IsApplicationBaseDirectorySpecified); Assert.IsNull(launcher.TestProject.TestPackage.WorkingDirectory); Assert.IsFalse(launcher.TestProject.TestPackage.IsWorkingDirectorySpecified); Assert.IsFalse(launcher.TestProject.TestPackage.ShadowCopy); Assert.IsFalse(launcher.TestProject.TestPackage.IsShadowCopySpecified); Assert.IsNull(launcher.TestProject.TestPackage.DebuggerSetup); Assert.IsFalse(launcher.TestProject.TestPackage.IsDebuggerSetupSpecified); Assert.IsNull(launcher.TestProject.TestPackage.RuntimeVersion); Assert.IsFalse(launcher.TestProject.TestPackage.IsRuntimeVersionSpecified); Assert.AreEqual(new PropertySet(), launcher.TestRunnerOptions.Properties); Assert.AreEqual(new PropertySet(), launcher.ReportFormatterOptions.Properties); }
private static void AssertTestLauncherOptions(TestLauncher launcher, string assemblyFile, string filterSetExpr) { Assert.IsFalse(launcher.DoNotRun); Assert.IsFalse(launcher.EchoResults); Assert.AreEqual(filterSetExpr, launcher.TestExecutionOptions.FilterSet.ToFilterSetExpr()); Assert.IsInstanceOfType(typeof(FilteredLogger), launcher.Logger); Assert.IsInstanceOfType(typeof(LogProgressMonitorProvider), launcher.ProgressMonitorProvider); Assert.IsFalse(launcher.ShowReports); Assert.AreEqual(StandardTestRunnerFactoryNames.IsolatedAppDomain, launcher.TestProject.TestRunnerFactoryName); Assert.IsNull(launcher.RuntimeSetup); Assert.AreElementsEqual(new string[] { assemblyFile }, from x in launcher.TestProject.TestPackage.Files select x.ToString()); Assert.AreElementsEqual(new string[] { }, from x in launcher.TestProject.TestPackage.HintDirectories select x.ToString()); Assert.AreEqual(Path.GetDirectoryName(assemblyFile), launcher.TestProject.TestPackage.ApplicationBaseDirectory.ToString()); Assert.IsFalse(launcher.TestProject.TestPackage.ShadowCopy); Assert.AreEqual(Path.GetDirectoryName(assemblyFile), launcher.TestProject.TestPackage.WorkingDirectory.ToString()); }
static DbSource CreateDev2TestingDbSource() { _containerOps = TestLauncher.StartLocalMSSQLContainer(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); var dbSource = new DbSource { ResourceID = Guid.NewGuid(), ResourceName = "Dev2TestingDB", DatabaseName = "Dev2TestingDB", Server = "TEST-MSSQL", AuthenticationType = AuthenticationType.User, ServerType = enSourceType.SqlDatabase, ReloadActions = true, UserID = "testUser", Password = "******", ConnectionTimeout = 30 }; return(dbSource); }
public void GivenISelectAsSqlServerSourceFor(string sourceName, string activityName) { if (sourceName == "NewSqlServerSource") { _containerOps = TestLauncher.StartLocalMSSQLContainer(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); } var proxyLayer = _scenarioContext.Get <StudioServerProxy>("proxyLayer"); var vm = GetViewModel(); Assert.IsNotNull(vm.SourceRegion); var dbSources = proxyLayer.QueryManagerProxy.FetchDbSources().ToList(); Assert.IsNotNull(dbSources, "dbSources is null"); var dbSource = dbSources.Single(source => source.Name == sourceName); Assert.IsNotNull(dbSource, "Source is null"); vm.SourceRegion.SelectedSource = dbSource; SetDbSource(activityName, dbSource); Assert.IsNotNull(vm.SourceRegion.SelectedSource); }
public void GivenIHaveWorkflowWithMySqlDatabaseConnector(string workflowName, string activityName) { var environmentModel = _scenarioContext.Get <IServer>("server"); environmentModel.Connect(); _containerOps = TestLauncher.StartLocalMySQLContainer(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); CreateNewResourceModel(workflowName, environmentModel); CreateDBServiceModel(environmentModel); var dbServiceModel = _scenarioContext.Get <ManageDbServiceModel>("dbServiceModel"); var mySqlActivity = new DsfMySqlDatabaseActivity { DisplayName = activityName }; var modelItem = ModelItemUtils.CreateModelItem(mySqlActivity); var mysqlDesignerViewModel = new MySqlDatabaseDesignerViewModel(modelItem, dbServiceModel, new SynchronousAsyncWorker(), new ViewPropertyBuilder()); var serviceInputViewModel = new ManageDatabaseServiceInputViewModel(mysqlDesignerViewModel, mysqlDesignerViewModel.Model); _commonSteps.AddActivityToActivityList(workflowName, activityName, mySqlActivity); DebugWriterSubscribe(environmentModel); _scenarioContext.Add("viewModel", mysqlDesignerViewModel); _scenarioContext.Add("parentName", workflowName); }
public void GivenILoadWorkflowFrom(string resourceName, string serverName) { if (serverName == "Remote Container") { WorkflowExecutionSteps._containerOps = TestLauncher.StartLocalCIRemoteContainer(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); } if (!serverName.Equals("localhost", StringComparison.InvariantCultureIgnoreCase)) { var remoteServer = environmentModel.FindSingle(a => a.Name.Equals(serverName, StringComparison.InvariantCultureIgnoreCase)); remoteServer.ConnectAsync().Wait(60000); remoteServer.ResourceRepository.Load(true); var remoteResource = remoteServer.ResourceRepository.FindSingle(p => p.ResourceName.Equals(resourceName, StringComparison.InvariantCultureIgnoreCase)); Assert.IsNotNull(remoteResource, "Resource \"" + resourceName + "\" not found on remote server \"" + serverName + "\"."); _scenarioContext.Add(remoteResourceString, remoteResource); } else { var localResource = localHost.ResourceRepository.FindSingle(p => p.ResourceName.Equals(resourceName, StringComparison.InvariantCultureIgnoreCase)); Assert.IsNotNull(localResource, "Resource \"" + resourceName + "\" not found."); _scenarioContext.Add(localResourceString, localResource); } }
public void GetDatabaseTables_Execute_ValidDatabaseSource() { var parser = new Mock <IActivityParser>(); parser.Setup(a => a.Parse(It.IsAny <DynamicActivity>())).Returns(new Mock <IDev2Activity>().Object); CustomContainer.Register(parser.Object); //------------Setup for test-------------------------- GetDatabaseColumnsForTableTests._containerOps = TestLauncher.StartLocalMSSQLContainer(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); var dbSource = CreateDev2TestingDbSource(); ResourceCatalog.Instance.SaveResource(Guid.Empty, dbSource, ""); var someJsonData = JsonConvert.SerializeObject(dbSource); var esb = new GetDatabaseTables(); var mockWorkspace = new Mock <IWorkspace>(); mockWorkspace.Setup(workspace => workspace.ID).Returns(Guid.Empty); //------------Execute Test--------------------------- var actual = esb.Execute(new Dictionary <string, StringBuilder> { { "Database", new StringBuilder(someJsonData) } }, mockWorkspace.Object); //------------Assert Results------------------------- var value = actual.ToString(); Assert.IsFalse(string.IsNullOrEmpty(value)); var result = JsonConvert.DeserializeObject <DbTableList>(value); Assert.IsTrue(result.Items.Count > 2); var duplicateTables = result.Items.FindAll(table => table.TableName.Contains("[City]")); Assert.AreEqual(2, duplicateTables.Count); var dboCityTable = duplicateTables.Find(table => table.Schema == "dbo"); var warewolfCityTable = duplicateTables.Find(table => table.Schema == "Warewolf"); Assert.IsNotNull(dboCityTable); Assert.AreEqual("dbo", dboCityTable.Schema); Assert.IsNotNull(warewolfCityTable); Assert.AreEqual("Warewolf", warewolfCityTable.Schema); }
public void SetUp() { launcher = new TestLauncher(); }
internal TestLauncherResult Execute() { var launcher = new TestLauncher { Logger = Logger, ProgressMonitorProvider = ProgressMonitorProvider, TestExecutionOptions = { FilterSet = GetFilterSet() }, ShowReports = ShowReports.IsPresent, DoNotRun = DoNotRun.IsPresent, IgnoreAnnotations = IgnoreAnnotations.IsPresent, EchoResults = !NoEchoResults.IsPresent, RunTimeLimit = runTimeLimit }; if (RunnerType != null) launcher.TestProject.TestRunnerFactoryName = RunnerType; if (RunnerExtensions != null) GenericCollectionUtils.ForEach(RunnerExtensions, x => launcher.TestProject.AddTestRunnerExtensionSpecification(x)); launcher.RuntimeSetup = new RuntimeSetup(); // Set the installation path explicitly to the path of the Gallio cmdlet task assembly // since otherwise we will look at the path of PowerShell.exe. launcher.RuntimeSetup.RuntimePath = Path.GetDirectoryName(AssemblyUtils.GetFriendlyAssemblyLocation(typeof(RunGallioCommand).Assembly)); if (ApplicationBaseDirectory != null) launcher.TestProject.TestPackage.ApplicationBaseDirectory = new DirectoryInfo(ApplicationBaseDirectory); if (WorkingDirectory != null) launcher.TestProject.TestPackage.WorkingDirectory = new DirectoryInfo(WorkingDirectory); if (ShadowCopy.HasValue) launcher.TestProject.TestPackage.ShadowCopy = ShadowCopy.Value.IsPresent; if (DebugTests.HasValue && DebugTests.Value.IsPresent) launcher.TestProject.TestPackage.DebuggerSetup = new DebuggerSetup(); if (RuntimeVersion != null) launcher.TestProject.TestPackage.RuntimeVersion = RuntimeVersion; foreach (string option in ReportFormatterProperties) { KeyValuePair<string, string> pair = StringUtils.ParseKeyValuePair(option); launcher.ReportFormatterOptions.AddProperty(pair.Key, pair.Value); } foreach (string option in RunnerProperties) { KeyValuePair<string, string> pair = StringUtils.ParseKeyValuePair(option); launcher.TestRunnerOptions.AddProperty(pair.Key, pair.Value); } ForEachItem(Files, launcher.AddFilePattern); ForEachItem(HintDirectories, x => launcher.TestProject.TestPackage.AddHintDirectory(new DirectoryInfo(x))); ForEachItem(PluginDirectories, x => launcher.RuntimeSetup.AddPluginDirectory(x)); if (ReportDirectory != null) launcher.TestProject.ReportDirectory = ReportDirectory; if (ReportNameFormat != null) launcher.TestProject.ReportNameFormat = ReportNameFormat; if (ReportTypes != null) GenericCollectionUtils.ForEach(ReportTypes, launcher.AddReportFormat); launcher.TestProject.ReportArchive = Runner.Reports.ReportArchive.Parse(ReportArchive); TestLauncherResult result = RunLauncher(launcher); return result; }
internal bool InternalExecute() { DisplayVersion(); var logger = new FilteredLogger(new TaskLogger(Log), verbosity); var launcher = new TestLauncher(); launcher.Logger = logger; launcher.ProgressMonitorProvider = new LogProgressMonitorProvider(logger); launcher.TestExecutionOptions.FilterSet = GetFilterSet(); launcher.ShowReports = ShowReports; launcher.DoNotRun = DoNotRun; launcher.IgnoreAnnotations = IgnoreAnnotations; launcher.RunTimeLimit = runTimeLimit; launcher.RuntimeSetup = new RuntimeSetup(); // Set the installation path explicitly to the path of the MSBuild task assembly // since otherwise we will look at the path of MSBuild.exe. launcher.RuntimeSetup.RuntimePath = Path.GetDirectoryName(AssemblyUtils.GetFriendlyAssemblyLocation(typeof(Gallio).Assembly)); if (EchoResults) launcher.TestProject.AddTestRunnerExtension(new TaskLogExtension(Log)); if (ApplicationBaseDirectory != null) launcher.TestProject.TestPackage.ApplicationBaseDirectory = new DirectoryInfo(ApplicationBaseDirectory.ItemSpec); if (WorkingDirectory != null) launcher.TestProject.TestPackage.WorkingDirectory = new DirectoryInfo(WorkingDirectory.ItemSpec); launcher.TestProject.TestPackage.ShadowCopy = ShadowCopy; if (Debug) launcher.TestProject.TestPackage.DebuggerSetup = new DebuggerSetup(); if (RuntimeVersion != null) launcher.TestProject.TestPackage.RuntimeVersion = RuntimeVersion; foreach (string option in ReportFormatterProperties) { KeyValuePair<string, string> pair = StringUtils.ParseKeyValuePair(option); launcher.ReportFormatterOptions.AddProperty(pair.Key, pair.Value); } foreach (string option in RunnerProperties) { KeyValuePair<string, string> pair = StringUtils.ParseKeyValuePair(option); launcher.TestRunnerOptions.AddProperty(pair.Key, pair.Value); } ForEachItemSpec(Files, launcher.AddFilePattern); ForEachItemSpec(HintDirectories, x => launcher.TestProject.TestPackage.AddHintDirectory(new DirectoryInfo(x))); ForEachItemSpec(PluginDirectories, x => launcher.RuntimeSetup.AddPluginDirectory(x)); if (ReportDirectory != null) launcher.TestProject.ReportDirectory = ReportDirectory.ItemSpec; if (ReportNameFormat != null) launcher.TestProject.ReportNameFormat = ReportNameFormat; if (ReportTypes != null) GenericCollectionUtils.ForEach(ReportTypes, launcher.AddReportFormat); if (ReportArchive != null) launcher.TestProject.ReportArchive = Runner.Reports.ReportArchive.Parse(ReportArchive); if (RunnerType != null) launcher.TestProject.TestRunnerFactoryName = RunnerType; if (RunnerExtensions != null) GenericCollectionUtils.ForEach(RunnerExtensions, x => launcher.TestProject.AddTestRunnerExtensionSpecification(x)); TestLauncherResult result = RunLauncher(launcher); ExitCode = result.ResultCode; LogResultSummary(logger, result); PopulateStatistics(result); return ExitCode == ResultCode.Success || ExitCode == ResultCode.NoTests || IgnoreFailures; }
public void DirectoryNotFoundTest() { Assert.ThrowsException <DirectoryNotFoundException>(() => TestLauncher.Launch("wrongpath")); }
/// <summary> /// Provided so that the unit tests can override test execution behavior. /// </summary> internal virtual TestLauncherResult RunLauncher(TestLauncher launcher) { return launcher.Run(); }
public RemoteProxyTestRunner() { launcher = new TestLauncher(); }
protected override void Dispose(bool disposing) { launcher = null; }
private void Launch(bool doNoRun) { MarkupStreamWriter logStreamWriter = TestLog.Default; var launcher = new TestLauncher(); launcher.TestProject.TestPackage = testPackage; launcher.Logger = new MarkupStreamLogger(logStreamWriter); launcher.TestExecutionOptions.FilterSet = new FilterSet<ITestDescriptor>(new OrFilter<ITestDescriptor>(filters)); launcher.TestProject.TestRunnerFactoryName = TestRunnerFactoryName; string reportDirectory = SpecialPathPolicy.For<SampleRunner>().GetTempDirectory().FullName; launcher.TestProject.ReportDirectory = reportDirectory; launcher.TestProject.ReportNameFormat = "SampleRunnerReport"; launcher.ReportFormatterOptions.AddProperty(@"SaveAttachmentContents", @"false"); launcher.AddReportFormat(@"Text"); // Disabled because the Xml can get really big and causes problems if the sample runner is used frequently. //launcher.AddReportFormat("Xml"); launcher.DoNotRun = doNoRun; GenericCollectionUtils.ForEach(testRunnerOptions.Properties, x => launcher.TestRunnerOptions.AddProperty(x.Key, x.Value)); using (logStreamWriter.BeginSection("Log Output")) result = launcher.Run(); using (logStreamWriter.BeginSection("Text Report")) { foreach (string reportPath in result.ReportDocumentPaths) { string extension = Path.GetExtension(reportPath); if (extension == ".txt") { logStreamWriter.WriteLine(File.ReadAllText(reportPath)); } else if (extension == ".xml") { logStreamWriter.Container.AttachXml(null, File.ReadAllText(reportPath)); } File.Delete(reportPath); } } }
public void GeneratesNCoverCoverageWithCorrectOptionsAndMergesIfNecessary(string factoryName, NCoverVersion version, string ncoverCoverageFile, bool includeLogArgument, bool runMultipleAssemblies) { string tempPath = SpecialPathPolicy.For<NCoverTestIsolationProviderIntegrationTest>().GetTempDirectory().FullName; string coverageFilePath = Path.Combine(tempPath, ncoverCoverageFile ?? "Coverage.xml"); string coverageLogFilePath = Path.Combine(tempPath, "CoverageLog.txt"); string ncoverArguments = includeLogArgument ? "//l \"" + coverageLogFilePath + "\"" + (version == NCoverVersion.V1 ? "" : " //ll Normal") : null; if (File.Exists(coverageFilePath)) File.Delete(coverageFilePath); if (File.Exists(coverageLogFilePath)) File.Delete(coverageLogFilePath); Type firstTestType = typeof(SimpleTest); Type secondTestType = typeof(DummyTest); TestLauncher launcher = new TestLauncher(); launcher.Logger = new MarkupStreamLogger(TestLog.Default); launcher.TestProject.TestPackage.AddFile(new FileInfo(AssemblyUtils.GetAssemblyLocalPath(firstTestType.Assembly))); if (runMultipleAssemblies) launcher.TestProject.TestPackage.AddFile(new FileInfo(AssemblyUtils.GetAssemblyLocalPath(secondTestType.Assembly))); launcher.TestProject.TestRunnerFactoryName = factoryName; launcher.TestExecutionOptions.FilterSet = new FilterSet<ITestDescriptor>( new OrFilter<ITestDescriptor>(new[] { new TypeFilter<ITestDescriptor>(new EqualityFilter<string>(firstTestType.FullName), false), new TypeFilter<ITestDescriptor>(new EqualityFilter<string>(secondTestType.FullName), false), })); if (ncoverArguments != null) launcher.TestRunnerOptions.AddProperty("NCoverArguments", ncoverArguments); if (ncoverCoverageFile != null) launcher.TestRunnerOptions.AddProperty("NCoverCoverageFile", ncoverCoverageFile); TestLauncherResult result; using (new CurrentDirectorySwitcher(tempPath)) result = launcher.Run(); NCoverTool tool = NCoverTool.GetInstance(version, ProcessorArchitecture.MSIL); if (! tool.IsInstalled()) { Assert.AreEqual(ResultCode.Failure, result.ResultCode); var logEntries = result.Report.LogEntries; Assert.AreEqual(1, logEntries.Count, "Expected to find a log entry."); Assert.AreEqual(LogSeverity.Error, logEntries[0].Severity); Assert.Contains(logEntries[0].Details, tool.Name + " does not appear to be installed."); } else { int passed = runMultipleAssemblies ? 2 : 1; int failed = 1; Assert.AreEqual(passed + failed, result.Statistics.RunCount); Assert.AreEqual(passed, result.Statistics.PassedCount); Assert.AreEqual(failed, result.Statistics.FailedCount); Assert.AreEqual(0, result.Statistics.InconclusiveCount); Assert.AreEqual(0, result.Statistics.SkippedCount); Assert.IsTrue(File.Exists(coverageFilePath), "The NCover runner should have written its coverage log to '{0}'.", coverageFilePath); string coverageXml = File.ReadAllText(coverageFilePath); File.Delete(coverageFilePath); Assert.Contains(coverageXml, firstTestType.Name, "Expected the coverage log to include information about the test method that we actually ran.\n" + "In NCover v3, there is now a list of excluded 'system assemblies' in NCover.Console.exe.config which " + "specifies MbUnit and Gallio by default. For this test to run, the file must be edited such that " + "these entries are removed."); if (runMultipleAssemblies) { Assert.Contains(coverageXml, secondTestType.Name, "Expected the coverage log to include information about the test method that we actually ran.\n" + "In NCover v3, there is now a list of excluded 'system assemblies' in NCover.Console.exe.config which " + "specifies MbUnit and Gallio by default. For this test to run, the file must be edited such that " + "these entries are removed."); } if (ncoverArguments != null && ncoverArguments.Contains("/l")) { Assert.IsTrue(File.Exists(coverageLogFilePath), "Should have created a coverage log file since the /l argument was specified."); File.Delete(coverageLogFilePath); } } }
public static void MyClassInitialize(TestContext testContext) => _containerOps = TestLauncher.StartLocalCIRemoteContainer(testContext.ResultsDirectory);
protected override TestLauncherResult RunLauncher(TestLauncher launcher) { Assert.IsNotNull(action, "The run launcher method should not have been called because no action was set."); return action(launcher); }
public void PathCreateTool_FileSystemIntellisenseProvider_UITest() { _containerOps = TestLauncher.StartLocalCIRemoteContainer(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults")); FileToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.PathCreate.SmallViewContentCustom.FileOrFolderComboBox.TextEdit.Text = @"\\rsaklfsvrpdc\"; Assert.IsTrue(UIMap.MainStudioWindow.IntellisenseOptionsList.FirstOption.Exists, "No file system provided intellisense results are showing."); }
internal void InternalExecute() { // We don't catch exceptions here because NAnt takes care of that job, // and decides whether to let them through based on the value of the // FailOnError var logger = CreateLogger(); DisplayVersion(); var launcher = new TestLauncher(); launcher.Logger = logger; launcher.ProgressMonitorProvider = new LogProgressMonitorProvider(logger); launcher.TestExecutionOptions.FilterSet = GetFilterSet(); launcher.ShowReports = ShowReports; launcher.DoNotRun = DoNotRun; launcher.IgnoreAnnotations = IgnoreAnnotations; launcher.EchoResults = EchoResults; launcher.RunTimeLimit = runTimeLimit; if (RunnerType != null) { launcher.TestProject.TestRunnerFactoryName = RunnerType; } if (RunnerExtensions != null) { foreach (Argument arg in RunnerExtensions) { launcher.TestProject.AddTestRunnerExtensionSpecification(arg.Value); } } launcher.RuntimeSetup = new RuntimeSetup(); // Set the installation path explicitly to the path of the NAnt task assembly // since otherwise we will look at the path of NAnt.exe. launcher.RuntimeSetup.RuntimePath = Path.GetDirectoryName(AssemblyUtils.GetFriendlyAssemblyLocation(typeof(GallioTask).Assembly)); if (ApplicationBaseDirectory != null) launcher.TestProject.TestPackage.ApplicationBaseDirectory = new DirectoryInfo(ApplicationBaseDirectory); if (WorkingDirectory != null) launcher.TestProject.TestPackage.WorkingDirectory = new DirectoryInfo(WorkingDirectory); if (ShadowCopy.HasValue) launcher.TestProject.TestPackage.ShadowCopy = ShadowCopy.Value; if (Debug.HasValue && Debug.Value) launcher.TestProject.TestPackage.DebuggerSetup = new DebuggerSetup(); if (RuntimeVersion != null) launcher.TestProject.TestPackage.RuntimeVersion = RuntimeVersion; foreach (Argument option in ReportFormatterProperties) { KeyValuePair<string, string> pair = StringUtils.ParseKeyValuePair(option.Value); launcher.ReportFormatterOptions.AddProperty(pair.Key, pair.Value); } foreach (Argument option in RunnerProperties) { KeyValuePair<string, string> pair = StringUtils.ParseKeyValuePair(option.Value); launcher.TestRunnerOptions.AddProperty(pair.Key, pair.Value); } AddAssemblies(launcher); AddHintDirectories(launcher); AddPluginDirectories(launcher); if (ReportDirectory != null) launcher.TestProject.ReportDirectory = ReportDirectory; if (ReportNameFormat != null) launcher.TestProject.ReportNameFormat = ReportNameFormat; if (ReportArchive != null) launcher.TestProject.ReportArchive = Runner.Reports.ReportArchive.Parse(ReportArchive); if (ReportTypes != null) { string[] typeNames = ReportTypes.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); GenericCollectionUtils.ForEach(typeNames, launcher.AddReportFormat); } TestLauncherResult result = RunLauncher(launcher); SetResultProperty(result.ResultCode); PopulateStatistics(result); if (!FailOnError) return; if (result.ResultCode != ResultCode.Success && result.ResultCode != ResultCode.NoTests) { // The only way to make the task fail is to throw an exception throw new BuildException(Resources.TestExecutionFailed); } }
/// <exclude /> /// <summary> /// Provided so that the unit tests can override test execution behavior. /// </summary> protected virtual TestLauncherResult RunLauncher(TestLauncher launcher) { return launcher.Run(); }
protected override TestLauncherResult RunLauncher(TestLauncher launcher) { Assert.IsNotNull(action, "The run launcher method should not have been called because no action was set."); return(action(launcher)); }
public static void StartRemoteContainer() => _containerOps = TestLauncher.StartLocalCIRemoteContainer(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestResults"));
public void TaskPassesSpecifiedArgumentsToLauncher() { TestLauncher launcher = new TestLauncher(); EchoArguments arguments = new EchoArguments(); arguments.DoNotRun = true; arguments.NoEchoResults = true; arguments.Filter = "Type: SimpleTest"; arguments.ReportDirectory = "dir"; arguments.ReportTypes = new string[] { "XML", "Html" }; arguments.ReportNameFormat = "report"; arguments.ShowReports = true; arguments.RunTimeLimitInSeconds = 7200; // seconds = 120 minutes arguments.RunnerType = StandardTestRunnerFactoryNames.Local; arguments.RunnerExtensions = new string[] { "DebugExtension,Gallio" }; arguments.PluginDirectories = new string[] { "plugin" }; arguments.Files = new[] { Assembly.GetExecutingAssembly().CodeBase }; arguments.HintDirectories = new string[] { "hint1", "hint2" }; arguments.ApplicationBaseDirectory = "baseDir"; arguments.WorkingDirectory = "workingDir"; arguments.ShadowCopy = true; arguments.Debug = true; arguments.RuntimeVersion = "v4.0.30319"; arguments.RunnerProperties = new[] { "RunnerOption1=RunnerValue1", " RunnerOption2 ", "RunnerOption3 = 'RunnerValue3'", "RunnerOption4=\"'RunnerValue4'\"" }; arguments.ReportFormatterProperties = new[] { "FormatterOption1=FormatterValue1", " FormatterOption2 ", "FormatterOption3 = 'FormatterValue3'", "FormatterOption4=\"'FormatterValue4'\"" }; EchoProgram.ConfigureLauncherFromArguments(launcher, arguments); Assert.IsTrue(launcher.DoNotRun); Assert.IsFalse(launcher.EchoResults); Assert.AreEqual("Type: SimpleTest", launcher.TestExecutionOptions.FilterSet.ToFilterSetExpr()); Assert.AreEqual("dir", launcher.TestProject.ReportDirectory); Assert.IsTrue(launcher.TestProject.IsReportDirectorySpecified); Assert.AreElementsEqual(new string[] { "XML", "Html" }, launcher.ReportFormats); Assert.AreEqual("report", launcher.TestProject.ReportNameFormat); Assert.IsTrue(launcher.TestProject.IsReportNameFormatSpecified); Assert.IsTrue(launcher.ShowReports); Assert.AreEqual(TimeSpan.FromMinutes(120), launcher.RunTimeLimit); Assert.AreEqual(StandardTestRunnerFactoryNames.Local, launcher.TestProject.TestRunnerFactoryName); Assert.IsTrue(launcher.TestProject.IsTestRunnerFactoryNameSpecified); Assert.Count(0, launcher.TestProject.TestRunnerExtensions); Assert.AreElementsEqual(new[] { "DebugExtension,Gallio" }, launcher.TestProject.TestRunnerExtensionSpecifications); Assert.IsNull(launcher.RuntimeSetup.ConfigurationFilePath); Assert.IsNull(launcher.RuntimeSetup.RuntimePath); Assert.AreElementsEqual(new[] { "plugin" }, launcher.RuntimeSetup.PluginDirectories); Assert.Count(1, launcher.FilePatterns); Assert.AreElementsEqual(new[] { "hint1", "hint2" }, from x in launcher.TestProject.TestPackage.HintDirectories select x.ToString()); Assert.AreEqual("baseDir", launcher.TestProject.TestPackage.ApplicationBaseDirectory.ToString()); Assert.IsTrue(launcher.TestProject.TestPackage.IsApplicationBaseDirectorySpecified); Assert.AreEqual("workingDir", launcher.TestProject.TestPackage.WorkingDirectory.ToString()); Assert.IsTrue(launcher.TestProject.TestPackage.IsWorkingDirectorySpecified); Assert.IsTrue(launcher.TestProject.TestPackage.ShadowCopy); Assert.IsTrue(launcher.TestProject.TestPackage.IsShadowCopySpecified); Assert.IsNotNull(launcher.TestProject.TestPackage.DebuggerSetup); Assert.IsTrue(launcher.TestProject.TestPackage.IsDebuggerSetupSpecified); Assert.AreEqual("v4.0.30319", launcher.TestProject.TestPackage.RuntimeVersion); Assert.IsTrue(launcher.TestProject.TestPackage.IsRuntimeVersionSpecified); Assert.AreEqual(new PropertySet() { { "RunnerOption1", "RunnerValue1" }, { "RunnerOption2", "" }, { "RunnerOption3", "RunnerValue3" }, { "RunnerOption4", "'RunnerValue4'" } }, launcher.TestRunnerOptions.Properties); Assert.AreEqual(new PropertySet() { { "FormatterOption1", "FormatterValue1" }, { "FormatterOption2", "" }, { "FormatterOption3", "FormatterValue3" }, { "FormatterOption4", "'FormatterValue4'" } }, launcher.ReportFormatterOptions.Properties); }