为什么Coded Ui的执行速度非常慢 [英] Why Coded Ui execution is very slow

查看:164
本文介绍了为什么Coded Ui的执行速度非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么Coded Ui执行速度非常慢

Why Coded Ui execution is very slow

推荐答案

您好SrikarReddy,

Hi SrikarReddy,

欢迎来到MSDN论坛。

Welcome to MSDN forum.

经过研究,我发现
适当答案
以提高执行时间,请参考以下答案代码:

After research, I found an appropriate answer to boost execution time, please refer the below code from the answer:

[CodedUITest]
public class CodedUITest1
{
    [TestInitialize]
    public void TestInit()
    {
        // Call a common routine to set up the test
        MyCodedUITests.StartTest();
    }

    [TestMethod]
    public void CodedUITestMethod1()
    {
        // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        this.UIMap.RecordedMethod1();
    }
}

class MyCodedUITests
{
    /// <summary> Test startup. </summary>
    public static void StartTest()
    {
        // Configure the playback engine

        Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.Disabled;  //allows the test to run at full speed. 
        Playback.PlaybackSettings.MaximumRetryCount = 10;  //wair for loading page then response
        Playback.PlaybackSettings.ShouldSearchFailFast = false;  //set full timeout to load page
        Playback.PlaybackSettings.DelayBetweenActions = 500;  //the delay time between the UI actions
        Playback.PlaybackSettings.SearchTimeout = 1000;  //the dafault is 3min

        // Add the error handler
        Playback.PlaybackError -= Playback_PlaybackError; // Remove the handler if it's already added
        Playback.PlaybackError += Playback_PlaybackError; // Ta dah...
    }

    /// <summary> PlaybackError event handler. </summary>
    private static void Playback_PlaybackError(object sender, PlaybackErrorEventArgs e)
    {
        // Wait a second
        System.Threading.Thread.Sleep(1000);

        // Retry the failed test operation
        e.Result = PlaybackErrorOptions.Retry;
    }
}

在我身边进行实验后,执行时间缩短了。

After the experiment in my side, the execution time is reduced.

预计会有任何反馈。

最诚挚的问候,

Dylan


这篇关于为什么Coded Ui的执行速度非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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