Coded UI Controls need to refresh
I am using a coded UI testing harness that looks at a jQuery grid that we have written. The problem that I am encountering is that when the grid pages, the coded ui keeps track of the old controls when I try to call the paging again. I guess an example would explain it better:
BaseMap.MSMaintenanceMap.PageNext();
BaseMap.MSMaintenanceMap.PageNext();
this is the code that I am trying to get to work. The problem is here in the generated designer file:
if ((this.mUITitlePagingRowRow == null))
{
this.mUITitlePagingRowRow = new UITitlePagingRowRow(this);
}
When I change it to this:
this.mUITitlePagingRowRow = new UITitlePagingRowRow(this);
it works every time. Probl开发者_StackOverflow中文版em is when the uitest gets re-generated, this reverts back for obvious reasons. Is there any additional parameters that anyone knows that I can put in the .uitest file to always get the latest version of a control?
Add AlwaysSearch to the SearchConfigurations of the control, this forces the test not to cache the control but always look for it using the defined properties. Hope this helps.
You can refresh the map from your test method. So when you are calling the method in the partial class for a second time just put something like BaseMap BaseMap = new BaseMap();
Then this will refresh the map and you can call BaseMap.MSMaintenanceMap.PageNext();
without the refresh problem.
Another way around this is to not rely on BaseMap.Designer.cs
. You can manually write the method in the BaseMap.cs
partial class. This does not get generated. Record the PageNext()
object into the map. Then write a method like this:
public void PageNext()
{
BaseMap = new BaseMap();
Mouse.Click('TheObjectYouRecorded');
}
Hope this helps.
精彩评论