I was just about to test drive this, on the first attempt I was trying to run the app, get the main window, but stopped right there. Here's the exception I got on accessing MainWindow:
at ArtOfTest.Common.Win32.Connector.InjectCode(IntPtr handle, String assemblyAndClass, String pipename, String pid, Boolean waitForDocument)
at ArtOfTest.WebAii.Wpf.WpfWindow.ConnectToWindow(IntPtr handle, String pipename, String pid)
at ArtOfTest.WebAii.Wpf.WpfApplication.get_MainWindow()
at ArtOfTest.WebAii.Core.Manager.LaunchNewApplication(ProcessStartInfo pinfo)
at NServiceBus.Profiler.FunctionalTests.StudioTestBase.Can_show_shell_window() in c:\Projects\NSBProfiler\NServiceBus.Profiler.FunctionalTests\StudioTestBase.cs:line 31
And what I did was pretty standard:
The app displays a splash screen on startup, maybe that's why getting the main window fails? Whatever the reason, I didn't expect a NRE.
at ArtOfTest.Common.Win32.Connector.InjectCode(IntPtr handle, String assemblyAndClass, String pipename, String pid, Boolean waitForDocument)
at ArtOfTest.WebAii.Wpf.WpfWindow.ConnectToWindow(IntPtr handle, String pipename, String pid)
at ArtOfTest.WebAii.Wpf.WpfApplication.get_MainWindow()
at ArtOfTest.WebAii.Core.Manager.LaunchNewApplication(ProcessStartInfo pinfo)
at NServiceBus.Profiler.FunctionalTests.StudioTestBase.Can_show_shell_window() in c:\Projects\NSBProfiler\NServiceBus.Profiler.FunctionalTests\StudioTestBase.cs:line 31
And what I did was pretty standard:
[Test]public void Can_show_shell_window(){ var appPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), ApplicationProcess); var processStartInfo = new ProcessStartInfo { FileName = appPath, UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true, }; var config = new Settings(); var manager = new Manager(config); var app = manager.LaunchNewApplication(processStartInfo); var mainWindow = app.MainWindow; var barManager = mainWindow.Find.ByAutomationId("BarManager"); Assert.IsNotNull(barManager);}The app displays a splash screen on startup, maybe that's why getting the main window fails? Whatever the reason, I didn't expect a NRE.