【发布时间】:2020-07-14 10:52:04
【问题描述】:
我正在为一个移动应用程序编写测试,其中第一个屏幕是登录屏幕。我确实已经涵盖了,但在其他测试中我想跳过 test_Login 并直接进入 test_DoStuffOnHomeScreen
最好的方法是什么?我正在使用
def get_desired_caps(application):
return dict(platformName='Android', deviceName="$DEVICE",
application=PATH('../apps/' + app), appPackage='xxx',
appActivity='xxx.MainActivity', newCommandTimeout=240, noReset='true', fullReset='false')
作为我想要的功能 - 当我在没有 noReset 和 fullReset 的情况下运行它时,它会将我带到登录屏幕,这很好。但是其他情况呢?我的开始会话脚本是这样的
class StartSession(unittest.TestCase):
def setUp(self):
desired_caps = desired_capabilities.get_desired_capabilities('xxx.apk')
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
self.application = Application(self.driver)
def tearDown(self):
self.driver.quit()
然后在测试中使用:
class LoginPage(StartSession):
def test_login_with_valid_credentials(self):
【问题讨论】:
-
创建一个接受参数“noReset”的方法,以便您可以根据需要传递参数。我已经在 Java 中这样做了。如果您想查看 java 代码,我可以发布它
标签: python selenium testing appium