译——你的下一个更好的手机自动化测试策略

邢德全
• 阅读 167

Your Next Better Mobile Test Automation Strategy

你的下一个更好的手机自动化测试策略

New mobile apps evolve at an exponential rate and frequent quality releases of new features have become a must to sustain the competitiveness in the mobile market and earn customer appreciation. Test automation is one of the most effective ways to optimize the mobile software development cycle without compromising quality. In this post, we’ve compiled important considerations that would help you set up a test automation strategy for successful mobile app testing.

新的手机APP以指数幂的速度在演变,频繁的高质量的新特色功能的发布能维持厂商在手机市场的竞争力,并且能够获取顾客的青睐。自动化测试是优化手机软件发展周期,而不影响质量最有效的方式之一。在这篇文章里,我们写了一些能够帮助你成功建立一个手机APP自动化测试策略的重要的思考。

Selecting the right test automation tool

Among the multiple types of mobile test automation tools available on the market, native object recognition tools are most preferred. They identify a UI object with a UI tree using XPath, CSS locators or the native object ID of the element. Such tools can access native elements and are more resilient to changes to UI, resolution, or a device itself.

选择一个合适的自动化测试工具

在市场上有各种各样的手机自动化测试工具可供选择,优先考虑本机对象识别工具。他们通过UI树用元素XPath,css定位符或者本机对象ID来标识UI。这种工具能够获取本机元素,并且能对UI,分辨率,或者设备本身做更具弹性的修改操作。

The native object recognition tools can be divided into 2 large groups: cross-platform (Appium, Calabash) and platform-specific further dividing into Android-specific (Espresso) and iOS-specific (XCUITest) tools.

本机对象识别工具划分为两个大的分类:跨平台(像Appium,Calabash)和特定平台,进一步细分为安卓专用工具(像Espresso)和IOS专用工具(像XCUITest)。

Cross-platform tools take the form of add-ons. They support black box testing and can test only what is exposed to the user. Cross-platform tools can also verify the input/output data coming to and from the back-end service layer as well as simulate activities that are controlled outside an app (screen rotations, pressing the home button, and more). They can run tests in parallel.

跨平台工具采用添加组件的形式。可以支持黑盒测试,但仅能测已经发布给使用者的内容。跨平台工具也能验证往返于后端服务层输入/输出数据,以及类似控制APP对外显示的活动(像屏幕旋转,主页键和其他一些操作)。他们能并行运行。

Platform-specific tools exist as drivers. They run inside an application, have access to application code (white box testing) and can interact with the app’s code for more thorough testing. Platform-specific tools execute tests much faster (up to 4-8 times faster). These tools are mostly used by developers since their usage requires significant technical skills.

特定平台工具作为驱动程序存在。它们在一个应用内部运行,有权限访问应用程序代码(白盒测试),并且能通过测试与APP程序代码交互进行更彻底的测试。特定平台工具执行测试更快(快了4到8倍)。这些工具绝大部分被开发人员使用因为它的使用要求更高的技术能力。

译——你的下一个更好的手机自动化测试策略

Managing device / OS diversity

In the modern mobile app market, there is the multiplicity of mobile device’s models. In addition, an average mobile user upgrades to the latest operation system once a month. The differences in each case can influence the app’s work. To ensure end-to-end quality, an ideal scenario is to test your mobile application (at least its most critical features) against high-priority devices When the number of these devices is significant, the overall cost of device lab maintenance becomes really high. There are two ways to get around this:

管理设备/操作系统多样性

当今的手机APP市场有各种各样的手机设备型号。除此之外,一个手机用户平均每个月都把手机系统升级到最新的操作系统。每个情况下的区别都能影响APP的运行。为了确保从端到端的质量,理想的方案是在高优先级的设备测试你的手机应用(至少是它最主要的性能)。当这些设备的数量庞大的时候,维持这些设备的总成本变得很高,这有两种方式能解决这个问题:

Using emulators & simulators

Emulators (Android SDK) and simulators (iOS Simulator) create the virtual environment that mimics major features of real mobile devices. Using simulators and emulators doesn’t cost a lot, but their behavior can differ from real-life scenarios and test execution is less speedy than with real device testing. Moreover, emulators and simulators can have bugs of their own and not all tools support emulation/simulation automation (Appium does).

使用仿真器和模拟器

仿真器(像安卓SDK)和模拟器(像IOS 模拟机)创建模拟真实移动设备重要功能的虚拟环境,使用仿真器和模拟器没有太多成本,但是他们的行为跟真实的设备还是有区别的,测试执行过程比用真机测试更慢。并且,仿真器和模拟器本身也会有错误,并不是所有的工具都支持仿真器或者模拟器的自动化 (Appium确实如此)。

Cloud-based test automation

Testing on real devices is more reliable for thorough testing. Subscription-based, device labs in the cloud (Sauce Labs, BrowserStack) offer a ready infrastructure to run tests against hundreds of devices and OSs without the burden of their maintenance. If your team is distributed geographically, cloud-based testing deserves special attention, since it allows the testers to use the same devices from different locations and save even more.

基于云端的自动化

测试过程中真机测试更加可靠。在云端基于订阅的设备实验室(像Sauce Labs, BrowserStack)提供已经准备就绪的运行测试的平台,能够承载上百的设备和操作系统而没有运维的负担。如果你的团队分布在不同地点,基于云端的测试就更需要关注了,因为它允许测试人员在不同的地点使用一样的设备,并且能过够存储更多数据。

Cloud-based device labs can also support emulators and simulators and usually offer easy integration with popular test automation tools (Selenium, UFT, and others).

基于云端的设备实验室也能支持仿真器和模仿器,通常能够便捷的跟主流的自动化测试工具做集成,像Selenium, UFT以及其他工具等。

Testing against different network conditions

Mobile apps have to deal with various network conditions: different network providers and modes of network communication (2G, 3G, 4G and LTE), the airplane mode. Make sure your test automation framework allows simulating all these options.

不同网络环境的测试

手机APP需要处理各种各样的网络环境:不同的网络提供商和网络模式(像2G, 3G, 4G and LTE),飞行模式等。确保你的自动化测试框架允许模拟这些选项。

Simulating back-end services

In mobile testing, not having access to the back end or third-party services from the very beginning of the development cycle is a typical problem. However, it’s vitally important to verify interactions between different parts of the mobile app architecture. Service virtualization (ServiceV, Micro Focus Service Virtualization, Tosca OSV, and others) can help start thorough testing early in the development, thus reducing costs of bug fixes and accelerating deployment.

模拟后端服务

在手机测试中,没法从一开始的开发周期获取后端或者第三方服务是一个典型的问题。然而,验证不同部分的手机app结构之间的交互是非常重要的,虚拟化服务(ServiceV, Micro Focus Service Virtualization, Tosca OSV, and others)能通过早期开发测试帮助减少错误修正成本并且加速部署。

Integrating manual and automated testing

To achieve top quality at speed and with optimal costs, we recommend using a balanced mix of manual and automated tests. For example, human eyes are still more effective to verify look and feel, usability, manage large freedom of mobile users’ actions, ensure quick verification of hotfixes and one-run tests, and more.

集成手动和自动化测试

为了在追求速度和最优成本的同时保证最佳质量,我们建议均衡混合使用手动和自动化测试。比如,在验证外观和实用性,管理手机使用操作的的更大限度的时候,能确保快速验证补丁和一次性测试,等等。

Further reducing time to launch

Test automation is fast, but there are ways to streamline it even more. For example, the process of test creation can be significantly accelerated through test code and data re-use (implementing the data-driven development (DDT) approach). To maximize test code re-use, make sure to:

进一步减少发布时间。

自动化测试快,但是仍有一些方法甚至能使它更加迅速。例如,能通过测试代码和数据的重复使用(使用数据驱动开发工具实现,像DDT)能显著的加速测试创建过程。为了测试代码最大化重复使用,请确保以下几点:

Identify the mobile manufacturers, OS versions you’ll work with and create automated scripts with a view to all supported devices right from the design stage.

明确手机生产商,你将要操作的操作系统版本和创建自动化脚本,以便从设备设计开始查看所有受支持的设备。

For hybrid applications, proactively determine the amount of reusable code that can be commonly tested with universal tests.

对于混合应用,用通用测试前瞻性的衡量在通用测试能被重复使用的代码的数量。

Along with test development optimization, there’re a number of options to speed up test execution. They include test parallelization (helps to achieve 5 times faster test execution, but it is available only for atomic and autonomous tests), automated test prioritization, use of smart waits, and more.

随着测试发展的优化,有些可以加速测试执行的选项。包括测试平行化(在测试执行的时候能提高5倍的速度,但是这种方法仅在原子测试和自主测试中可用),自动化测试优先,智能等待使用,等等。

Wrapping it up

We hope that these short guidelines will help you make more informed decisions about your mobile test automation strategy as well as inspire further topic investigation.

武装起来吧

我们希望这些简短的指导能在你的手机自动化测试策略中做更明智的决定,同时也希望能激发进一步探索的方向。

作者:Ivan Boyanov

龙测科技,您身边的自动化测试专家。

官网:http://www.dragontesting.cn

点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Irene181 Irene181
4年前
手机自动化测试IDE ----- Airtest的安装和IDE控件详解
大家好,我是IT共享者,人称皮皮。这篇文章主要给大家分享手机自动化测试IDEAirtest的安装和IDE控件详解相关知识,一起来看看吧。前言前面小编带大家讲解了一些用来做自动化的模块,但是如果是在手机上做自动化了,我们还能搞定吗?也许有人觉得抓手机的数据包都费劲,还搞什么自动化,而且肯定不简单。但我要告诉你的是,这一切都被一个叫Airtest的自动化测试
Irene181 Irene181
4年前
手机自动化测试IDE ----- Airtest的安装和IDE控件详解
大家好,我是IT共享者,人称皮皮。这篇文章主要给大家分享手机自动化测试IDEAirtest的安装和IDE控件详解相关知识,一起来看看吧。前言前面小编带大家讲解了一些用来做自动化的模块,但是如果是在手机上做自动化了,我们还能搞定吗?也许有人觉得抓手机的数据包都费劲,还搞什么自动化,而且肯定不简单。但我要告诉你的是,这一切都被一个叫Airtest的自动化
Python进阶者 Python进阶者
4年前
手机自动化测试IDE ----- Airtest的安装和IDE控件详解
大家好,我是IT共享者,人称皮皮。这篇文章主要给大家分享手机自动化测试IDEAirtest的安装和IDE控件详解相关知识,一起来看看吧。前言前面小编带大家讲解了一些用来做自动化的模块,但是如果是在手机上做自动化了,我们还能搞定吗?也许有人觉得抓手机的数据包都费劲,还搞什么自动化,而且肯定不简单。但我要告诉你的是,这一切都被一个叫Airtest的自动化测
高复用性自动化脚本设计实践
在自动化测试实践中,为了更好的契合被测业务场景,需要不断优化框架分层结构。本文结合产品模块化思路,意在介绍通过策略模式改造原本复杂分支语句代码,通过理论讲解、思路分析、方案设计、及代码演示,提供自动化脚本重构的落地方案。
梦
4年前
微信小程序new Date()转换时间异常问题
微信小程序苹果手机页面上显示时间异常,安卓机正常问题image(https://imghelloworld.osscnbeijing.aliyuncs.com/imgs/b691e1230e2f15efbd81fe11ef734d4f.png)错误代码vardate'2021030617:00:00'vardateT
Stella981 Stella981
3年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Easter79 Easter79
3年前
Twitter的分布式自增ID算法snowflake (Java版)
概述分布式系统中,有一些需要使用全局唯一ID的场景,这种时候为了防止ID冲突可以使用36位的UUID,但是UUID有一些缺点,首先他相对比较长,另外UUID一般是无序的。有些时候我们希望能使用一种简单一些的ID,并且希望ID能够按照时间有序生成。而twitter的snowflake解决了这种需求,最初Twitter把存储系统从MySQL迁移
Stella981 Stella981
3年前
RobotFramework自动化测试之元素定位
前言:最近在做基于RF框架的Web自动化测试,其中涉及到元素的定位,主要用到id、name、xpath、css四中定位方法,尤其后面的两种方法特别有效,可以解决大部分的定位问题。
陈哥聊测试 陈哥聊测试
1年前
自动化测试框架知识,读这一篇就够了!
什么是真正的自动化测试框架?自动化脚本如何工作?自动化测试框架会如何在测试过程中为你提供竞争优势?
美凌格栋栋酱 美凌格栋栋酱
5个月前
Oracle 分组与拼接字符串同时使用
SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(
邢德全
邢德全
Lv1
寂寞空庭春欲晚,梨花满地不开门。
文章
4
粉丝
0
获赞
0