简体   繁体   中英

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)

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.

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:

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. 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. For example

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

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. To get the first view call

solo.waitForView(0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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