Coded UI test takes 2-3 minutes to pass

試著忘記壹切 提交于 2019-12-20 06:12:35

问题


So I am working with Coded UI to run some automated tests and one of the tests takes an extremely long time to complete.

I used breakpoints and found that after End Get in the bottom block of code, nothing happens for minutes and then finally the Assert.AreEqual completes and the test passes.

I tried changing a few playback settings but nothing changed. Does anyone know what is going on, and how I can fix it?

-The first block of code is a generated Assert method that gets called by the test

-The second block of code is called in the Assert parameters

    '''<summary>
    '''assert_clicked_columnhead_requestor - Use 'assert_clicked_columnhead_requestorExpectedValues' to pass parameters into this method.
    '''</summary>
    Public Sub assert_clicked_columnhead_requestor()
        Dim uINameCell As HtmlCell = Me.UIAppWindow1.UIAppDocument.UIX978532666mkrdataTblTable1.UINameCell

        'Verify that 'Name' cell's property 'InnerText' equals 'Name'
        Assert.AreEqual(Me.assert_clicked_columnhead_requestorExpectedValues.UINameCellInnerText, uINameCell.InnerText)
    End Sub


    Public Overridable ReadOnly Property assert_clicked_columnhead_requestorExpectedValues() As assert_clicked_columnhead_requestorExpectedValues
        Get
            If (Me.massert_clicked_columnhead_requestorExpectedValues Is Nothing) Then
                Me.massert_clicked_columnhead_requestorExpectedValues = New assert_clicked_columnhead_requestorExpectedValues()
            End If
            Return Me.massert_clicked_columnhead_requestorExpectedValues 'PROBLEM HERE
        End Get
    End Property

As requested

    '''<summary>
    '''click_columnhead_requestor
    '''</summary>
    Public Sub click_columnhead_requestor()
        Dim uIRequestorCell As HtmlHeaderCell = Me.UIAppWindow1.UIAppDocument.UIRequestorCell

        'Click 'Requestor' cell
        Mouse.Click(uIRequestorCell, New Point(51, 23))
    End Sub

    Public ReadOnly Property UIAppWindow1() As UIAppWindow1
        Get
            If (Me.mUIAppWindow1 Is Nothing) Then
                Me.mUIAppWindow1 = New UIAppWindow1()
            End If
            Return Me.mUIAppWindow1
        End Get
    End Property

    Public ReadOnly Property UIX978532666mkrdataTblTable1() As UIX978532666mkrdataTblTable1
        Get
            If (Me.mUIX978532666mkrdataTblTable1 Is Nothing) Then
                Me.mUIX978532666mkrdataTblTable1 = New UIX978532666mkrdataTblTable1(Me)
            End If
            Return Me.mUIX978532666mkrdataTblTable1
        End Get
    End Property

回答1:


Coded UI does searches for precisely what is given in the search and filter properties, that operates quite fast. However, if that search fails then Coded UI does a smart match trying to find something similar and that can take a long time. It is necessary because titles etc can change a little from run to run. Changing the tests to avoid needing a smart match can dramatically improve the search speed. The general approach is to modify the search from equality to contains and to remove the part of the string that changes. A Microsoft blog explains in more detail, see http://blogs.msdn.com/b/dave_froslie/archive/2012/08/10/why-do-my-coded-ui-tests-pause-during-playback.aspx




回答2:


¿? have you tried changing the value of ..

Playback.PlaybackSettings.SearchTimeout = miliseconds;

msdn playbacksettings.searchtimeout

good luck and tell us something



来源:https://stackoverflow.com/questions/19280845/coded-ui-test-takes-2-3-minutes-to-pass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!