0

コード化された UI テスト ビルダーに、既に記録されているクラスを強制的に使用させる方法はありますか? 単一の記録セッション内でも、非常によく似たクラスが作成されます。

たとえば、以下で生成された 2 つのクラスの URL の唯一の違い。コードを再利用したいのですが、そのような重複は意味がありません。手動クリーンアップ以外に何かありますか?

public class UISearchResultsOracleDocument : HtmlDocument
{
    public UISearchResultsOracleDocument(UITestControl searchLimitContainer) :
        base(searchLimitContainer)
    {
        #region Search Criteria
        this.SearchProperties[HtmlDocument.PropertyNames.Id] = null;
        this.SearchProperties[HtmlDocument.PropertyNames.RedirectingPage] = "False";
        this.SearchProperties[HtmlDocument.PropertyNames.FrameDocument] = "False";
        this.FilterProperties[HtmlDocument.PropertyNames.Title] = "Search Results : " + EnterSearchedTextParams.UISearchEditText;
        this.FilterProperties[HtmlDocument.PropertyNames.AbsolutePath] = "/project/Pages/results.aspx";
        this.FilterProperties[HtmlDocument.PropertyNames.PageUrl] = "http://my.url.com:123/project/Pages/results.aspx?k=Oracle";
        this.WindowTitles.Add("Search Results : Oracle");
        #endregion
    }
 // ...

}

//そしてほぼ重複

public class UISearchResultsOracleDocument1 : HtmlDocument
{
    public UISearchResultsOracleDocument1(UITestControl searchLimitContainer) :
        base(searchLimitContainer)
 {
     #region Search Criteria
     this.SearchProperties[HtmlDocument.PropertyNames.Id] = null;
     this.SearchProperties[HtmlDocument.PropertyNames.RedirectingPage] = "False";
     this.SearchProperties[HtmlDocument.PropertyNames.FrameDocument] = "False";
     this.FilterProperties[HtmlDocument.PropertyNames.Title] = "Search Results : Oracle";
     this.FilterProperties[HtmlDocument.PropertyNames.AbsolutePath] = "/project/Pages/results.aspx";
     this.FilterProperties[HtmlDocument.PropertyNames.PageUrl] = "http://my.url.com:123/project/Pages/results.aspx?k=Oracle&start1=1";
     this.WindowTitles.Add("Search Results : Oracle");
     #endregion
 }
// ...
}

したがって、問題は重複をどのように排除するかです。UIMap の新しいクラスの数を減らすためのヒントはありますか?

ありがとう

百合

4

1 に答える 1

0

リンクの下に行ってみてください..

http://blogs.msdn.com/b/gautamg/archive/2009/12/18/why-is-coded-ui-test-generated-code-not-a-straight-line-code.aspx

http://blogs.msdn.com/b/gautamg/archive/2009/12/21/understanding-the-code-generated-by-coded-ui-test-part-2.aspx

上記のリンクから:

私たちが思いついたコード生成のガイドライン (受け取ったフィードバックに基づくものもあります) は -

Encourage reusability of the test code. This is both for productivity

そしてより良いメンテナンス。データ ドライビングなどの一般的なシナリオで、コードのカスタマイズを容易にします。高度な操作のためにコードを完全に制御します。

いつでも同じコードを手で書くことができますが、それを記録するよりもはるかにトリッキーです。

于 2011-01-08T18:25:27.097 に答える