我正在使用Instrumentation編寫自動化測試用例。 「waitforMonitorWithTimeout」 總是超時。如果我使用waitForMonitor,一切都很好。代碼的兩行 代碼如下。 (我在建立我的測試項目時註釋掉其中的一個)。Android waitForMonitorWithTimeout方法不起作用
Activity currentActivity = instrumentation.waitForMonitorWithTimeout(monitor,(long)30);
活動currentActivity = instrumentation.waitForMonitor(monitor);
是否存在與「waitforMonitorWithTimeout」有關的已知問題?我必須使用超時 來確定是否發生事件(並因此轉換爲新活動)。
謝謝,但我已經使用「checkMonitorHit」添加了檢查,並且它也出現了錯誤。看起來好像當使用「waitforMonitorWithTimeout」時顯示器的實際設置/擊中功能不起作用。很幸運,我不能使用「waitforMonitor」(沒有超時),因爲導致監視器命中的動作可能會發生,也可能不會發生,我需要處理這兩種情況。 – Jack 2010-08-26 13:26:32