卸载应用程序时测试 [英] Uninstall application when testing

查看:154
本文介绍了卸载应用程序时测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Andr​​oid中使用Robotium测试。我如何编程卸载,然后运行一些测试前安装应用程序?

I'm new to testing in Android with Robotium. How can I programatically uninstall and then install the application before running some of the tests?

例如,为了让我来测试登录活动,我需要确保的登录凭据不从以前的应用程序运行保存。还是有另一种方式来做到这一点?

For example, in order for me to test the login activity, I need to make sure the login credentials are not saved from a prior run of the app. Or is there another way to do this?

推荐答案

您可以用下面的一段code的(你从调试机器)来卸载应用程序:

You could use the following piece of code (on the machine you're debugging from) to uninstall your application:

Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("adb uninstall your.package");
pr.waitFor();

这篇关于卸载应用程序时测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆