Coded UI Test Builder записывает похожие классы, создавая многочисленные классы в UIMap - PullRequest
0 голосов
/ 03 ноября 2010

Есть ли способ заставить Coded UI Test Builder использовать уже записанные классы? Он создает очень похожие классы даже в течение одного сеанса записи.

например. единственная разница в 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?

Спасибо

Юрий

1 Ответ

0 голосов
/ 08 января 2011

попробуйте перейти по ссылкам ниже.

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

и улучшенное обслуживание.Упростите настройку кода для распространенных сценариев, таких как Data Driving.Дайте полный контроль над кодом для продвинутой операции.

Вы всегда можете передать один и тот же код. Но гораздо сложнее, чем записать его.

...