如何在monkeyrunner测试文件中导入py文件函数
我想在 Monkeyrunner 中为我的 Android 应用程序创建测试用例。
我正在考虑在实际测试用例之前创建一个子测试用例文件。与 install 、 uninstall 函数一样,它们位于单独的 py 文件中。我如何在 Monkeyrunner 测试用例中调用这些安装/卸载 apk 或任何其他函数?
我有一个成功的实验,从 PYTHON 中我的 py 文件中的其他导入的 py 文件调用函数。但在运行 Monkeyrunner 时无法调用相同的函数。
import new
print new.foo()
这在通过 python 运行时有效,但在 Monkeyrunner 中无效。 有什么解决办法吗?
I want to create test cases for my Android application in Monkeyrunner.
I am thinking to create a sub tests case file to do before actual test case. like a install , uninstall functions in a separate py file. How can i call these install/uninstall apk or any other function in my monkeyrunner test case?
I have a successful experiment of calling a function from other imported py file in my py file in PYTHON. but same function cannot called while running through monkeyrunner.
import new
print new.foo()
this is working while running through python but not working in monkeyrunner.
Any solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Monkeyrunner (jython) 和 python 应该以完全相同的方式导入模块,唯一的区别可能是模块搜索路径的内容。
要验证它,请尝试:
在 python 和 Monkeyrunner 中,看看是否有任何差异。
如果你想包含一些路径, do
并且应该可以工作。
monkeyrunner (jython) and python should import modules exactly the same way, the only difference might be the content of the module search path.
To verify it try:
in both python and monkeyrunner and see if there are any differences.
If you want to include some path, do
and should work.