Appium-设计页面对象以与iOS和Android重用相同的功能 [英] Appium - Design page object to reuse same function with iOS and Android

查看:210
本文介绍了Appium-设计页面对象以与iOS和Android重用相同的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在我的Appium和Python项目中使用页面对象来仅在iOS平台上运行测试.现在,我需要为Android实施相同的测试(应用程序相同).

I'm currently using page objects in my Appium and Python project to run the tests only on the iOS platform. Now I need to implement the same tests for Android (the app is the same).

我知道每个平台的定位器都不同,但是我创建的功能可以在两个平台上使用.

I know the locators are different for each platform, but the functions I created I can use for both platforms.

在Java中,@iOSXCUITFindBy@AndroidFindBy批注使此设计更容易,但是到目前为止,我还没有找到与Appium和Python一起使用的类似东西.

In java the @iOSXCUITFindBy and @AndroidFindBy annotations make design easier for this purpose, but so far I haven't found anything similar to use with Appium and Python.

我可以使用哪种策略在两个平台(Android和iOS)上重用相同的功能?

What strategy can I use to reuse the same functions for both platforms (Android and iOS)?

推荐答案

我使用Robot Framework(python)创建了测试套件,以测试iOS和Android应用程序的开发.相同的应用程序并在同一时间启动.自动化是在sprint中完成的.在开发应用程序时进行自动化测试.

I used Robot Framework (python) to create test suites for testing the development of an iOS and Android app. Same app and started at the same time. Automation was done in sprint. Automated tests as the app was being developed.

最初,我们同时为两个平台创建了自动化测试.与上述类似的想法...如果/其他等等... 几个月后,我们遇到了问题.我不像If/Else那样简单.在开发过程中,SAME APP在两个移动平台上的功能发生了变化.在iOS和Android平台上,您可以做的事情(在开发/技术方面)有所不同.

Initially we created automated tests for both platforms at the same time. Similar ideas to above...If/Else etc... We ran into issues after a few months. I wasn't as simple as If/Else. Functionality of the SAME APP across two mobile platforms changed during the development. Differences in what you can do (development/technical wise) on iOS vs Android platforms differs in some points.

它们本质上是同一应用程序,但是由于某些技术限制而存在差异.测试分配根本无法在两个平台上同时使用,并且需要付出努力和丑陋的测试才能使它们成为可能.

They essentially were the same app but they had differences created by some technical limitations. Allot of tests were simply not applicable across both platforms and would have required allot of effort and ugly tests to shoehorn them to be.

然后,一个平台成为另一个平台的优先级.但是,为这两个平台的测试功能打下基础是企业不希望/不需要的开销,因为一个平台是一个优先事项(可以选择其他平台在以后成为优先事项).

One platform then became a priority over the other. But laying the groundwork for test functionality for both platforms has an overhead which the business didn't want/need as one platform was a priority (with option for he other to become the priority at a later date).

六个月后放弃了双重测试套件,转而将Android Test Suite与iOS Test Suite分开.

Dropped dual test suites after six months in favour of Android Test Suite separate to iOS Test Suite.

当然有一些重叠,但是分配变得更容易管理.

Sure there was some overlap but it became allot easier to manage.

如果我要重新开始,我会在一开始就将它们分开.

If I were to start over I would have kept them separate at the start.

tldr :)将它们分开(明智的文件夹/套件结构和功能).

tldr :) Keep them separate (folder/suite structure and functionality wise).

这篇关于Appium-设计页面对象以与iOS和Android重用相同的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆