编码的UI:如何在测试套件执行结束时停止Visual Studio杀死在执行期间启动的应用程序。 [英] Coded UI : How can i stop the Visual studio to kill the application launched during the execution at the end of test suite execution.

查看:88
本文介绍了编码的UI:如何在测试套件执行结束时停止Visual Studio杀死在执行期间启动的应用程序。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在自动化Windows应用程序,需要在执行测试用例期间重新启动。

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.

如何阻止它。我希望Visual Studio不会在测试套件结束时测试用例执行期间终止任何应用程序。

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.

 我已经使用过AUT.CloseOnPlaybackCleanup  = false;。

 I have already used AUT.CloseOnPlaybackCleanup  = false;.

请建议任何解决方案。

问候

Nitin

推荐答案

Hi Nitin,

Hi Nitin,

欢迎来到MSDN论坛。

Welcome to MSDN forum.

>> 我希望Visual Studio在测试结束时不应该杀死任何应用程序
套件。

对于这个问题,如果项目中有多个测试方法,那么你想要的是为了防止应用程序在方法1之后被杀死,并继续在方法2.3.4.5中使用它,那么AUT.CloseOnPlayBackCleanUp可以
工作。

< span style ="color:black; background:white">关于如何使用它的示例:

[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();
        }
    }

但如果您想要的是阻止应用程序在所有测试完成后被杀死的测试执行,我担心CloseOnPlayBackCleanUp无法正常工作。并且在所有测试方法完成后,似乎没有有效的方法来阻止实例被测试引擎杀死。
来自这个
的更多信息
doc

希望以上所有内容都有所帮助。感谢您的理解。

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

最好的问候

Lance


这篇关于编码的UI:如何在测试套件执行结束时停止Visual Studio杀死在执行期间启动的应用程序。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆