0
我通過創建所有映射並手動編寫測試,在我的機器(Windows 8.1)上創建編碼的UI測試。 (我不使用Action Recordings)當他們在Nightly機器(Server 2012R2)上晚上運行時,選擇我的Group Lookup窗口的操作實際上會在測試運行期間選擇我的客戶代碼查找窗口。如何修復UI控件地圖控件失去映射?
在我的機器上重新映射控件並不能解決這個問題,並且無法在Server2012R2機器上重新映射它們,因爲它僅用於運行不運行Visual Studio的測試。
控件上可用的搜索屬性不足以區分控件。相反,我試圖在控制修改好記的名稱屬性和使用下面的代碼:
public void ClickControl(WinControl mycontrol, string resultId)
{
UITestControlCollection controls = mycontrol.FindMatchingControls();
foreach (UITestControl allControls in controls)
{
if (allControls.FriendlyName == resultId)
{
Mouse.Click(allControls);
}
}
}
但是當我運行的代碼似乎在程序運行時不使用友好名稱的修改後的值。
有沒有辦法確保在發送Mouse.Click事件之前選擇正確的控件?
您確定'Customer Code lookup window'有正確的'FriendlyName'嗎? – mcalex
客戶代碼查詢的友好名稱是「...」,集團代碼查找的友好名稱也是如此。我分別將它們更改爲「CustCodeLookup」和「GroupCodeLookup」。當我在組代碼查詢上運行上述功能時,當我調用allControls.FriendlyName時仍然傳入「...」。 – Ashley
嘗試類似'someDebugOutputStream.Writeline(「Friendlyname'{0}'」,allControls.FriendlyName);'就在'if ...'之前。注意輸出中的'''字符,因此顯示領先/訓練空間等。 – AdrianHHH