質問
AutomationProperties.NameプロパティがXAMLでプログラム的および宣言的にどのように使用されるかを誰かが(できればコード例で)説明できますか?
説明
たとえば、VisualStudio2010のCodedUIBuilderは、ウィンドウの名前をSearchPropertyとして使用することを理解しています。
ウィンドウの名前が変更されたため、コード化されたUIテストが信頼できる一定のSearchPropertyが必要です。
以下のコード例では、ウィンドウのタイトルが「パイプ1のプロパティ」としてハードコーディングされないようにします。
コード例
[GeneratedCode("Coded UITest Builder", "10.0.30319.1")]
public class UIListViewPropertiesTable1 : WpfTable
{
public UIListViewPropertiesTable1(UITestControl searchLimitContainer) :
base(searchLimitContainer)
{
#region Search Criteria
this.SearchProperties[WpfTable.PropertyNames.AutomationId] = "listViewProperties";
this.WindowTitles.Add("Properties of Pipe 1");
#endregion
}
#region Properties
public WpfText NameOfComponent
{
get
{
if ((this.mNameOfComponent == null))
{
this.mNameOfComponent = new WpfText(this);
#region Search Criteria
this.mNameOfComponent.SearchProperties[WpfText.PropertyNames.Name] = "Pipe 1";
this.mNameOfComponent.WindowTitles.Add("Properties of Pipe 1");
#endregion
}
return this.mNameOfComponent;
}
}
#endregion
#region Fields
private WpfText mNameOfComponent;
#endregion
}
リンク
次に例を示します。方法:データバインドされたWPFリストまたはコンボボックスで自動化を適切に機能させる。私はそれをウィンドウに適応させることができませんでした。