그래서 Visual Studio에서 코드 생성기를 사용하여 코딩 된 UI 테스트를 생성했습니다. TreeList가있는 wpf 응용 프로그램이 있습니다. 첫 번째 상자로 이동하여 값을 입력 한 다음 두 번째 상자를 클릭하고 새 값을 입력합니다. 슈퍼 멋지다.녹음 된 CodedUI에서 녹음 된 컨트롤을 찾을 수 없습니다.
public void RecordedMethod1()
{
#region Variable Declarations
WpfCell uIItemCell = this.UIWindowWindow.UIEntityTesterControlCustom.UIEntityTesterTreeListTree.UIEntityTesterTreeListTreeItem.UIItemCell;
WpfEdit uIInvoice1InvoiceIDEdiEdit = this.UIWindowWindow.UIEntityTesterControlCustom.UIEntityTesterTreeListTree.UIEntityTesterTreeListTreeItem.UIItemCell.UIInvoice1InvoiceIDEdiEdit;
WpfCell uIItemCell1 = this.UIWindowWindow.UIEntityTesterControlCustom.UIEntityTesterTreeListTree.UIEntityTesterTreeListTreeItem.UIItemCell1;
WpfEdit uI_localTextBoxEdit = this.UIWindowWindow.UIEntityTesterControlCustom.UIEntityTesterTreeListTree.UIEntityTesterTreeListTreeItem.UIItemCell11.UI_localTextBoxEdit;
#endregion
// Click cell
Mouse.Click(uIItemCell, new Point(92, 18));
// Type '1' in 'Invoice:1/InvoiceID|Editor' text box
uIInvoice1InvoiceIDEdiEdit.Text = this.RecordedMethod1Params.UIInvoice1InvoiceIDEdiEditText;
// Click cell
Mouse.Click(uIItemCell1, new Point(136, 9));
// Type '2/1/2012' in '_localTextBox' text box
uI_localTextBoxEdit.Text = this.RecordedMethod1Params.UI_localTextBoxEditText;
}
#region Properties
public virtual RecordedMethod1Params RecordedMethod1Params
{
get
{
if ((this.mRecordedMethod1Params == null))
{
this.mRecordedMethod1Params = new RecordedMethod1Params();
}
return this.mRecordedMethod1Params;
}
}
그것은 내가 말할 수있는 (I 다양한 느린 단계/널 (null) 검사를했을 때) 지금까지
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException was unhandled by user code
HResult=-268111872
Message=The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'UIA'
FrameworkId: 'Wpf'
ControlType: 'Custom'
ClassName: 'Uia.EntityTesterControl'
AutomationId: 'EntityTesterControl'
Search may have failed at 'Test Suite Tools' Custom as it may have virtualized children. If the control being searched is descendant of 'Test Suite Tools' Custom then including it as the parent container may solve the problem.
Source=Microsoft.VisualStudio.TestTools.UITesting
BasicMessage=The playback failed to find the control with the given search properties.
RootElement=""
StackTrace:
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapControlNotFoundException(COMException ex, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowComException(COMException innerException, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, String queryId)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetUITestControlRecursive(Boolean useCache, Boolean alwaysSearch, ISearchArgument searchArg, IList`1 windowTitles, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetUITestControlRecursive(Boolean useCache, Boolean alwaysSearch, ISearchArgument searchArg, IList`1 windowTitles, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetUITestControlRecursive(Boolean useCache, Boolean alwaysSearch, ISearchArgument searchArg, IList`1 windowTitles, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetUITestControlRecursive(Boolean useCache, Boolean alwaysSearch, ISearchArgument searchArg, IList`1 windowTitles, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetElement(Boolean useCache, ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.Search(ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindInternal()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindPrivate()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<Find>b__37()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Find()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetPropertyPrivate(String propertyName)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<>c__DisplayClass3b.<GetProperty>b__3a()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetProperty(String propertyName)
at Microsoft.VisualStudio.TestTools.UITesting.ALUtility.GetTechElementFromUITestControl(UITestControl uiTestControl)
at Microsoft.VisualStudio.TestTools.UITesting.ActionExecutorManager.GetActionExecutor(UITestControl uiControl)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.ClickImplementation(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.<>c__DisplayClass6.<Click>b__5()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, Point relativeCoordinate)
at RoadExercises.UIMap.RecordedMethod1() in c:\Users\dtan\Documents\Visual Studio 2013\Projects\CodedUITestProject1\CodedUITestProject1\UIMap.Designer.cs:line 46
at RoadExercises.RoadExercises.IrVerifyFillInField(String p1, String p2) in c:\Users\dtan\Documents\Visual Studio 2013\Projects\CodedUITestProject1\CodedUITestProject1\RoadExercises.cs:line 169
at RoadExercises.RoadExercises.RoadExercise1b() in c:\Users\dtan\Documents\Visual Studio 2013\Projects\CodedUITestProject1\CodedUITestProject1\RoadExercises.cs:line 139
InnerException: System.Runtime.InteropServices.COMException
HResult=-2147467259
Message=Error HRESULT E_FAIL has been returned from a call to a COM component.
Source=Microsoft.VisualStudio.TestTools.UITest.Playback
ErrorCode=-2147467259
StackTrace:
at Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IScreenElement.FindAllDescendants(String bstrQueryId, Object& pvarResKeys, Int32 cResKeys, Int32 nMaxDepth)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindAllScreenElement(String queryId, Int32 depth, Boolean singleQueryId, Boolean throwException, Boolean resetSkipStep)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindScreenElement(String queryId, Int32 depth, Boolean resetSkipStep)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindScreenElement(String queryId, Int32 depth)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)
InnerException:
전화를 처음 Mouse.Click()에이 오류와 충돌합니다. UIEntityTesterTreeListTree에 대한 컨트롤을 찾을 수 없습니다. 매핑 된 경로 아래에 위치하지 않은 것 같습니다. 분명히이 경로는 UIWindowWindow.UIEntityTesterControlCustom.UIEntityTesterTree의 간단한 경우는 아니지만 이전에는 몇 가지 하위 영역이 있습니다.
몇 번이나 다시 매핑하려고 시도했지만 행운이 없습니다. 차라리 열심히 코딩하지 않을 것입니다. 그래서 누군가가 여기에서이 문제를 해결할 수있는 방법을 찾길 원합니다.
감사합니다.
웹에서 오류 메시지의 일부를 검색하면 많은 조회가 발생합니다. "검색 결과가 가상화 된 어린이 일 수 있으므로 실패했을 수 있습니다."라는 검색 결과의 첫 번째 결과는 메시지 및 해결 방법에 대한 설명이 포함 된 Microsoft 블로그 (타파스)입니다. ' 없음 주사위, – AdrianHHH
그것이 WpfCell/WpfEdit에게 을'this.UIWindowWindow.UIEntityTesterControlCustom.Container = this.UIWindowWindow.UIPART_DockSitePane.UITabbedMdiContainer2fPane 선언하지 후 코드에이 줄을 추가하여 자신의 솔루션 @AdrianHHH을 시도했다. ( – DanTan