locked
Coded UI : How can i stop the Visual studio to kill the application launched during the execution at the end of test suite execution. RRS feed

  • Question

  • Hi,

    I am automating a windows application, which need to be restart during the execution of test case.

    But the application got killed when the test suite get complete execution.

    How can i stop this. I want that Visual Studio should not kill any application during test case execution at the end of test suite.

     I have already used AUT.CloseOnPlaybackCleanup  = false;.

    Kindly suggest any solution.

    Regards

    Nitin

    Tuesday, January 29, 2019 5:41 AM

All replies

  • Hi Nitin,

    Welcome to MSDN forum.

    >> I want that Visual Studio should not kill any application during test case execution at the end of test suite.

    For this issue, If you have several test methods in a project, and what you want is to keep the app not being killed after method1, and continue to use it in method2.3.4.5, then the AUT.CloseOnPlayBackCleanUp can work.

    A sample about how to use it:

    [CodedUITest]
        public class CodedUITest1
        {
            private static ApplicationUnderTest AUT;
            public CodedUITest1()
            {
            }
    
            [TestMethod]
            public void CodedUITestMethod1()
            {
                AUT = ApplicationUnderTest.Launch(@"C:\Users\username\Desktop\WindowsFormsAppForCP.exe");
                this.UIMap.RecordedMethod1();
                AUT.CloseOnPlaybackCleanup=false;
    
            }
            [TestMethod]
            public void CodedUITestMethod2()
            {
                this.UIMap.RecordedMethod2();
                AUT.CloseOnPlaybackCleanup = false;
                // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            }
            [TestMethod]
            public void CodedUITestMethod3()
            {
                this.UIMap.RecordedMethod3();
            }
        }

    But if what you want is to prevent the app launched during the test execution from being killed after all tests complete, I’m afraid the CloseOnPlayBackCleanUp can’t work for it. And it seems no valid way currently to prevent the instance from being killed by test engine after all test methods complete. More information from this doc.

    Hope all above can help. Thank you for your understanding.

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, January 29, 2019 11:24 AM
  • Hi Nitin,

    Sorry to bother you, I'm just wondering if my reply is helpful for you? And did you solve this issue yet?

    Any feedback we want to hear you.

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 31, 2019 7:22 AM