MSTest:
- Open your .testsettings file and check the "Enable Deployment" under the deployment section.
- In your test project right-click and select Add Existing Item.
- Browse to the build location of your application to test.
- Find your executable and select "Add as link" (make sure you either include all of your apps dependent DLL's if they are not already referenced by your test project.)
- Right click the link to the executable and select "Copy Always" (this will copy a new version of the .exe to your tests bin directory when it is built)
In your [TestInitialize] add the following to launch your app:
_yourApp = ApplicationUnderTest.Launch(Path.Combine(Directory.GetCurrentDirectory(), "yourexecutablename.exe"));
In your [TestCleanup] you add the following:
_yourApp.Close();
NUnit: (you will need to reference and use Microsoft.VisualStudio.TestTools.UITesting)
- In your test project right-click and select Add Existing Item.
- Browse to the build location of your application to test.
- Find your executable and select "Add as link" (make sure you either include all of your apps dependent
DLL's if they are not already referenced by your test project.)
- Right click the link to the executable and select "Copy Always" (this will copy a new version of the .exe to your tests bin directory when it is built)
In your [Setup] add the following to launch your app:
_yourApp = ApplicationUnderTest.Launch("yourexecutablename.exe"));
In your [Teardown] you add the following:
_yourApp.Close();
note: I have not verified the NUnit implementation