我正在使用Visual Studio 2013 Premium。并且在尝试使用Microsoft.VisualStudio.TestTools.UnitTesting
创建UI测试时遇到问题问题是应用程序我正在尝试编写测试,在任何特定测试完成后自动关闭。但我需要在测试完成后保持应用程序保持打开状态你能告诉我怎样才能得到理想的结果?
请参阅代码示例:
[TestClass]
public class TestsForApplication
{
private Application application;
private Commands commands;
[TestInitialize]
public void TestInit()
{
application = new Application();
if (!Application.IsAppRunning)
{
application.OpenApplication(@"c:\Untitled.exe");
}
commands = new Commands();
}
[TestMethod]
public void IsViewWindowOpened()
{
commands.ViewWindow();
Thread.Sleep(TimeSpan.FromSeconds(3));
Assert.IsTrue(application.IsWindowAvailable<ViewWindow>());
}
`application.OpenApplication()` method is implemented based on `Process.Start()` method.
那么,您能告诉我如何在测试结束后让应用程序不自动关闭?