title: How to programmatically start a WPF application from a unit test?
body: <p><strong>Problem</strong></p>
  
  <p>VS2010 and TFS2010 support creating so-called <a href="http://blogs.microsoft.co.il/blogs/shair/archive/2009/05/20/vs2010-coded-ui-test.aspx" rel="noreferrer">Coded UI Tests</a>. All the demos I have found, start with the WPF application already running in the background when the Coded UI Test begins or the EXE is started using the absolute path to it.</p>
  
  <p>I, however, would like to start my WPF application under test from the unit test code. That way it'll also work on the build server and on my peer's working copies.</p>
  
  <p>How do I accomplish that?</p>
  
  <p><strong>My discoveries so far</strong></p>
  
  <p>a) This post shows <a href="http://www.c-sharpcorner.com/Resources/Detail.aspx?ResourceId=844" rel="noreferrer">how to start a XAML window</a>. But that's not what I want. I want to start the App.xaml because it contains XAML resources and there is application logic in the code behind file.</p>
  
  <p>b) The second screenshot on <a href="http://blogs.msdn.com/amit_chatterjee/archive/2009/03/14/coded-ui-test.aspx" rel="noreferrer">this post</a> shows a line starting with</p>
  
  <pre><code>ApplicationUnterTest calculatorWindow = ApplicationUnderTest.Launch(...);
  </code></pre>
  
  <p>which is conceptually pretty much what I am looking for, except that again this example uses an absolute path the the executable file.</p>
  
  <p>c) A <a href="http://www.google.ch/search?q=Programmatically+start+wpf" rel="noreferrer">Google search for "Programmatically start WPF"</a> didn't help either.</p>