简体   繁体   中英

Coded UI Test: ApplicationUnderTest close after test complete

I have seen lot of answered for same question on stakeoverflow but nothing is working for me.

I am using Visual studio 2013. I have a very simple Test

[CodedUITest]
public class CodedUITest1
{
     static ApplicationUnderTest _application;
    [TestMethod]
    public void CodedUITestMethod1()
    {
        var mainWindow = ApplicationUnderTest.Launch(@"C:\Program Files (x86)\Notepad++\notepad++.exe");
        mainWindow.CloseOnPlaybackCleanup = false;
        _application = mainWindow;                 
    }
}

I am setting CloseOnPlaybackCleanup to false as mentioned below.

 mainWindow.CloseOnPlaybackCleanup = false;

But whenever i run/debug test, application get close after test is completed. I have noticed that for browser window if we set CloseOnPlaybackCleanup to false then it work fine and browser window do not close. I am expecting same behavior for my this test.

can anyone please help me to identify if anything is missing?

Regards.

Replace launching code with below line:

var mainWindow = Process.Start(@"C:\\Program Files (x86)\\Notepad++\\notepad++.exe");

this should not close your application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM