私はWindowsPhoneTestFrameworkを使用しましたが、素晴らしいですが、横向きや縦向きなどでテストするためにエミュレーターのレイアウトを変更する要素の幅と高さを設定するなど、必要な機能の一部をサポートしていません.追加しようとしている間何らかの理由で幅や高さのような単純なコマンドが機能しないため、AutomationClient をデバッグする必要があります。たとえば、WindowsPhoneTestFramework.Client.AutomationClient.Remote で作成した SetWidthCommand で何が起こっているかを確認し、テスト対象のアプリケーションでプロパティが更新されない理由を理解する必要があります。
SetWidth コマンドを作成し、次のようにコンソールから呼び出します: setWidth id=widthValue
AutomationIdentifier と値を含むコマンドが作成される ApplicationAutomationController に到達するまでデバッグできます。SyncExecuteCommand の後に結果が false になります。これは、クライアントに問題があることを意味するため、Client.AutomationClient で SetWidthCommand をデバッグするにはどうすればよいでしょうか。リモート これは Client.AutomationClient.Remote の SetWidthCommand です。
public partial class SetWidthCommand
{
protected override void DoImpl()
{
var element = GetUIElement();
if (element == null)
return;
if (AutomationElementFinder.SetElementProperty(element, "Width", Value))
{
SendSuccessResult();
return;
}
//setWidth ContentPanel 400
if (ValueCommandHelper.TrySetValue(element, Value.ToString(CultureInfo.InvariantCulture)))
{
SendSuccessResult();
return;
}
// if width is missing... then give up
SendNotFoundResult();
}
ありがとうございました。