编码的ui测试在服务器上的随机时间失败 [英] Coded ui Test fails at random times on server

查看:73
本文介绍了编码的ui测试在服务器上的随机时间失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对测试环境还很陌生,但是我遇到了问题。

I am fairly new to the testing environment but I am stuck with a problem.

我创建了一个测试用例(一些测试与一个有序测试结合在一起)当我在自己的PC上运行它们时,它们总是会通过(请确保尝试了多次),但是当我在服务器上运行测试时,测试会随机失败。
的示例-他没有右键单击列表以获取上下文菜单
-他似乎忘记了单击按钮,因此无法访问下一个窗口。等等
如果我再次运行测试,他可能会克服以前的失败,但在其他方面失败。

i have created a test case (a few tests combined in an ordered test) and when I run them on my own pc they always pass (tried it many times to be sure) but when I run the test on our server the test fails at random times. examples - he doesn't right click a list to get the context menu - he seems to forget to click on a button so he cant access the next window. etc if i run the test again he may go over the previous fail but fails on something else.

到目前为止。在我跑步的30次中,他测试了5次成功跑步。并且这应该是基本测试,因此应该没有错误或已知问题。
我觉得服务器需要更多时间才能完成测试。因此,我进行了研究,并且已经添加了许多playbacksettings和一个Playback_PlaybackError。 Visual Studio 2013部分制作的
测试用例,并记录部分书面代码。建立在Visual Studio和服务器中,并使用Microsoft Test Manager 2013测试过,win8 envir

so far. out of +- 30 times i have run he test i had 5 success runs. and this should be a base test so there should be no bug or known problem. i have the feeling that the server needs more time to complete the test. so i did research and already added many playbacksettings and a Playback_PlaybackError. test case made in Visual studio 2013 part with recording part written code. build in visual studio and server tested with microsoft test manager 2013, win8 envir

我做错了什么吗?还是服务器配置有问题?

is there anything i do wrong? or is there something wrong with the server configuration?

预先感谢。

到目前为止,我尝试了一些这些(并在每个测试方法中重复)

so far I tried some of these (and repeat in every testmethod)

    public CodedUITest1()
    {
        Playback.PlaybackSettings.MatchExactHierarchy = true;

        Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.Control;
        Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.TopLevelWindow;
        Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.None;

        Playback.PlaybackSettings.SearchTimeout = 2000;
        Playback.PlaybackSettings.ShouldSearchFailFast = true;

        Playback.PlaybackSettings.ThinkTimeMultiplier = 2;

        Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.AllThreads;
        Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.UIThreadOnly;
        Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.Disabled;

        Playback.PlaybackSettings.WaitForReadyTimeout = 2000;
        Playback.PlaybackError -= Playback_PlaybackError;
        Playback.PlaybackError += Playback_PlaybackError;
    }

    /// <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;

    }


推荐答案

尝试使用

yourcontrol.WaitForControlReady() 

以及在对控件执行任何操作之前的功能。此功能将停止线程,直到您的控件准备好接受任何操作为止。

function as well before performing any action on control. This function will stop the thread till your control becomes ready for accepting any action.

这篇关于编码的ui测试在服务器上的随机时间失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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