Is there a way to force Coded UI Test Builder to use it’s already recorded classes? It creates very similar classes even within single recording session.
E.g. the only difference in URL in two classes generated below. I’d like to reuse code – no sense to have such duplications. Anything besides manual cleanup?
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
}
// ...
}
//And almost duplicate
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
}
// ...
}
Thus, question is how to eliminate duplication? Any hints to decrease number of new classes in UIMap?
Thanks
Yuri