![](/img/trans.png)
[英]How to run Espresso instrumentation tests in parallel in Firebase Test Lab?
[英]Espresso Instrumentation Tests - how to uninstall or delete the app after the test
我設置了Espresso工具框架來運行我的Android Functional Automation測試。 對於每個測試,我都想登錄到該應用程序並在完成測試后刪除該應用程序。
因此,我設置如下所示:
公共類FirstSampleTest擴展了BaseTest {
private final BaseTest baseTest;
//私有最終ElementUtils elementUtils;
public FirstSampleTest() throws InterruptedException {
this.baseTest = new BaseTest();
}
@Before
public void initiate() throws InterruptedException {
//I have setup login method here to login to the app after it installs
}
@Rule
public ActivityTestRule<SplashScreenActivity> splashScreenActivityActivityTestRule = new ActivityTestRule(SplashScreenActivity.class);
@Test
public void testTheHomeScreen() throws InterruptedException {
//Some tests go here.
}
@After
public void teardown() throws InterruptedException {
//I want to uninstall the app or delete it from the emulator once the test is run
}
}
無法從Instrumentation測試中卸載該應用。 但是,一旦運行了所有測試,該應用程序將自動卸載。
注意:僅當運行單個測試時,才會卸載應用程序。 請使用命令./gradlew connectedAndroidTest運行整個構建
您可以在Run -> Edit Configurations
中的Android Studio Before launch
部分中添加gradle任務 。
單擊+
->添加可識別gradle的Make-> :app:uninstallAll
注意:: :app:uninstallAll
“ app”取決於您的主模塊名稱。 因此可以是:my_module:uninstallAll
或:company:uninstallAll
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.