2017-05-04 92 views
0

我想自動化我的Android應用程序。當我開始測試時,我嘗試從調試抽屜中切換環境。在切換環境時,應用程序關閉併爲該特定環境打開一個新實例。該測試在應用程序關閉時失敗。在Android的Espresso測試切換環境

收到此錯誤:原因:「儀表運行失敗是由於「進程崩潰」

有什麼辦法劇本並沒有失敗,等到新的應用程序打開

回答

0

您需要使用uiautomator以及espresso用於這類用例。使用Uiautomator切換環境,然後讓咖啡步驟運行。

詳情refer- https://developer.android.com/topic/libraries/testing-support-library/index.html#UIAutomator

The UI Automator testing framework provides a set of APIs to build UI tests that perform interactions on user apps and system apps. The UI Automator APIs allows you to perform operations such as opening the Settings menu or the app launcher in a test device. The UI Automator testing framework is well-suited for writing black box-style automated tests, where the test code does not rely on internal implementation details of the target app.