简体   繁体   中英

Send command-line arguments to MonkeyRunner script

I am starting to explore writing MonkeyRunner scripts as part of my test suite. I am testing two apps: a free version and a paid version. I would like to write a single test script which I can run against either of these two apps. Is it possible to send command-line arguments to my MonkeyRunner script? For example, I imagine providing the Android package name in this way. Or perhaps is there another solution to my problem? I'm certainly open to suggestions.

Yes, it's possible. sys.argv contains the command line options and arguments you may have passed to the script. In this regard there's no difference with other python interpreters. The only thing you should avoid is to use command line options -u , -s , -p , -v and -plugin as they are used by monkeyrunner itself, albeit some of them not documented.

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