我们可以在不连接PC的情况下在Android手机上运行Instrumentationtestcases吗?
我使用 Android 手机的 Instrumentationtestcase 包为标准浏览器应用程序编写了一些测试用例。
当手机连接到电脑时,我能够运行测试。
有没有办法将这些测试用例包含在应用程序中,以便在调用活动时运行这些测试用例!
提前致谢
I wrote some test cases for a standard browser app using instrumentationtestcase packages for an android phone.
i am able to run the tests when the phone is connected to pc ..
is there a way to include these test cases in the app in such a way that these test cases are run when an activity is invoked!!
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Adb Wireless(需要 root)之类的工具,它可以让您(从 IDE)运行和测试应用程序,但无需电缆。
如果您想要的是通过从设备调用某些内容来运行测试......那么我不知道这是否可能。但至少它看起来非常没用……如果你看不到失败的地方,运行 JUnit 测试还有什么意义呢?
You could use something like Adb Wireless (requires root) which lets you run and test your applications (from the IDE) but without having a cable.
If what you want is running tests by invoking something from the device... then I don't know if it's possible. But at least it seems very useless... what's the point of running JUnit tests if you cannot see what failed?
如果我正确理解了你的问题,我会说是的。
Android 模拟器中有“开发工具”可用。您只需要在 Eclipse 中创建模拟器即可。然后您需要从模拟器获取/安装该应用程序到您连接的设备。之后,您在设备中安装测试项目。然后,您将能够通过从开发工具的 Instrumentation 菜单选项中选择该测试项目来独立于您的 PC 运行该测试项目。
以下是命令(您可以相应地更改路径):
要将正在运行的模拟器复制到连接的设备,请执行:
adb -e pull /system/app/Development.apk ./Development.apk
将 .apk 文件复制到当前目录。然后使用以下命令将其安装到连接的设备上:
adb -d install Development.apk
希望这是您的问题和所需的解决方案。
I would say yes if I have understood your question correctly.
There is "Dev Tools" available in Android emulator. You just need to create emulator in Eclipse. Then you need to fetch/install this application from emulator to your connected device. After that you install your test project in your device. Then you will be able to run that test project independent of your PC by selecting it from Instrumentation menu option of Dev Tools.
Following are the commands (you can change paths accordingly):
To copy from a running emulator to connected device, execute:
adb -e pull /system/app/Development.apk ./Development.apk
To copies the .apk file into the current directory. Then install it on your connected device with:
adb -d install Development.apk
Hope this was your problem and required solution.