0
我正在编写一个WPF应用程序的编码ui。 该项目包含约30测试和在测试initilaize我有提交登录的方法。 的问题是,在某些情况下,我得到的错误:编码的ui - 无法执行'SetProperty'到文本框
Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException was unhandled by user code
Message=Cannot perform 'SetProperty of Text with value "admin"' on the control. Additional Details:
TechnologyName: 'UIA'
ControlType: 'Edit'
AutomationId: 'UserName'
大多数的犯规发生这个错误的时间。
我很难找到bug一致性。
我可以说,如果我将重新启动代理服务,并将运行30测试 - 我不会有这个错误。 但如果我将运行10测试 - 没有服务重新启动 - 再次运行10测试我将有可能性错误重现。
完整的错误日志:
Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException was unhandled by user code
Message=Cannot perform 'SetProperty of Text with value "admin"' on the control. Additional Details:
TechnologyName: 'UIA'
ControlType: 'Edit'
AutomationId: 'UserName'
Source=Microsoft.VisualStudio.TestTools.UITesting
BasicMessage=Cannot perform 'SetProperty of Text with value "admin"' on the control.
HResult=-268111863
Action=SetProperty of Text with value "admin"
ObjectName=UserName
StackTrace:
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowComException(COMException innerException, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(SystemException exception, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(SystemException exception, String actionName, UITestControl uiControl)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(SystemException exception, String actionName, Object parameterValue, UITestControl uiControl)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.SetPropertyValue(String propertyName, Object propertyValue)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.SetProperty(String propertyName, Object value)
at Microsoft.VisualStudio.TestTools.UITesting.WpfControls.WpfEdit.set_Text(String value)
InnerException: System.Runtime.InteropServices.COMException
Message=Exception from HRESULT: 0xF004F006
Source=Microsoft.VisualStudio.TestTools.UITest.Playback
ErrorCode=-268111866
StackTrace:
at Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IScreenElement.SetValueAsEditBox(String bstrNewValue, Int32 nSetValueAsEditBoxFlag)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.SetValueAsEditBox(String value, Boolean isEncoded, Int32 flag)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.SetValueAsEditBox(String value, Boolean isEncoded)
at Microsoft.VisualStudio.TestTools.UITesting.TechnologyElementPropertyProvider.SetValueAsEditBox(UITestControl uiControl, String value, Boolean isEncoded, Boolean useCopyPaste)
at Microsoft.VisualStudio.TestTools.UITesting.WpfPropertyProvider.SetEditProperty(String propertyName, Object value)
at Microsoft.VisualStudio.TestTools.UITesting.WpfPropertyProvider.SetPropertyValue(UITestControl uiControl, String propertyName, Object value)
at Microsoft.VisualStudio.TestTools.UITesting.UITestPropertyProvider.SetPropertyValueWrapper(UITestControl uiControl, String propertyName, Object value)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.SetPropertyValue(String propertyName, Object propertyValue)
InnerException: