我设置了 Espresso 仪器框架来运行我的 Android 功能自动化测试。对于每次测试,我都想在完成测试后登录应用程序并删除应用程序。
所以,我设置如下:
公共类 FirstSampleTest 扩展 BaseTest {
private final BaseTest baseTest;
// 私有 final 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
}
}