简体   繁体   中英

Use Monkeyrunner for test complicated app

I am new in testing android app. I select monkeyrunner way for testing android app. I don't know python but i reading this. I have a complicated app, my app have a class that extend application and another activity for splash and then my app go to first activity. I set startActivity(firstActivity) in py file, in cmd shows my app run correctly and monkeyimage take a screenshot from my screen (home screen) but my app not run and not shows firstActivity in my device phone! i run startActivity(splash) but again not shows on my screen. Why? I test this in a simple app with one activity, when i run startActivity(firstActivity) on the screen, i see my simple app. How can solve this problem? and How can i go to another activity with monkeyrunner? I mean from application go to splash and from splash go to firstActivity?!

Thanks for your advices!

First of all, use

adb logcat

to see the package and the starting Activity name.. if you find these two for example package='pck.package' and activity = '.Main' then what you should write in your code, is:

package = 'pck.package'
activity = '.Main'
runComponent = package+'/'+activity
device.startActivity(component=runComponent)

in other words, you must use the package name as well in your code

Hope it helps

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