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

查看:41
本文介绍了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 应用程序的开发.相同的应用程序并同时启动.自动化是在冲刺中完成的.在开发应用时进行自动化测试.

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 测试套件与 iOS 测试套件分开.

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天全站免登陆