简体   繁体   English

在APK文件上使用Robotium

[英]Use robotium on apk file

I have to test apk file using robotium without source code .I tried (sample project given for calculator on this link and executed it successfully) 我必须使用robotium来测试无源代码的 apk文件。我尝试过(此链接上为计算器提供的示例项目已成功执行)

https://code.google.com/p/robotium/downloads/detail?name=ExampleTestProject_v4.2.zip&can=2&q= https://code.google.com/p/robotium/downloads/detail?name=ExampleTestProject_v4.2.zip&can=2&q=

Now I am trying to execute it on more complex apk file but it is giving me an error that it could not find R.Java file for ids of the field of app. 现在,我正在尝试在更复杂的apk文件上执行它,但它给我一个错误,即找不到应用程序字段ID的R.Java文件。

How should I go for it. 我应该怎么做。 Thanks. 谢谢。

The example test project is developed for an app with source code. 示例测试项目是为带有源代码的应用程序开发的。 If there is no source code you have to use methods like solo.getView(String id) etc. For more information on how to test apks with example code go here: 如果没有源代码,则必须使用诸如solo.getView(String id)等方法。有关如何使用示例代码测试apk的更多信息,请转到此处:

https://code.google.com/p/robotium/wiki/RobotiumForAPKFiles https://code.google.com/p/robotium/wiki/RobotiumForAPKFiles

If you know how the IDs are named in the source code, try using ExtSolo, which is an extension of Robotium. 如果你知道的ID是如何在源代码命名,请尝试使用ExtSolo,这是Robotium的延伸。 It has lots of methods that let you use a string version of an id to get a view, image or text on the screen. 它有很多的,让你使用一个ID的字符串版本,以获得在屏幕上查看,图像或文字的方法。 For example 例如

solo.waitForViewById("com.example.id.view1", 10000);

http://docs.testdroid.com/_static/extSolodocs/com/bitbar/recorder/extensions/ExtSolo.html http://docs.testdroid.com/_static/extSolodocs/com/bitbar/recorder/extensions/ExtSolo.html

If you don't know the id names in the source code, then you can use the Robotium methods that access views by index. 如果你不知道在源代码中的ID名称,然后你可以使用Robotium方法,通过索引访问的观点。 To get the first view call 进行首次观看电话

solo.waitForView(0);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM