苹果公司30%_使用苹果测试mj%C3%B6lnir xcuitest

苹果公司30%

Image for post

Our constant endeavour at Hotstar, has been to deliver amazing experiences digitally, to millions of customers in the most frictionless way possible. These are those experiences that are not explained by words but are felt, when you are binge watching a show or when you are downloading a content while travelling or when you are watching live cricket in a low network zone or when you are watching Avengers on your living room home theatre setup. (Lot of “ORs” right. No more. But I think you get the idea)

我们在Hotstar的不懈努力,就是以最轻松的方式以数字方式为数百万客户提供出色的体验。 这些是当您狂暴地观看节目或旅行时下载内容,在低网络区域观看现场板球或在自己的地方观看复仇者时无法用言语解释的体验客厅家庭影院设置。 (很多“ OR”对。没有。但是我想你明白了。)

To a customer, an experience is a sum of content and the application that delivers it with all its bells and whistles. To ensure good quality quality, we have to get it right, everytime, across platforms and technologies, that span, a diverse ecosystem of mobile, web, Smart TVs and set top boxes.

对客户而言,体验是内容和应用程序的总和,它可以带给您无尽的欢乐。 为了确保高质量,我们必须跨平台,跨技术,跨移动,Web,智能电视和机顶盒的多样化生态系统,始终做到最好。

We need to be able to consistently test, repeatedly, 24/7, pushing our code to boundaries so that it mimics user behavior, contexts and application states that a user experiences. To do this right and with confidence, we wanted to invest in automation technologies which are scalable, reliable and provide depth in how they can exploit the application under test as we take it through the paces.

我们需要能够始终如一地反复测试24/7,将我们的代码推向边界,以便它模仿用户所体验的用户行为,上下文和应用程序状态。 为了正确而有信心地做到这一点,我们希望投资自动化技术,这些技术具有可伸缩性,可靠性,并随着我们的发展逐步深入地介绍了它们如何利用被测应用程序。

While Mickey, Aladdin, and the Avengers took care of high quality content part of the problem (aren’t they just awesome!), we focussed on experimenting with different automation frameworks to get quality thoroughly analysed for the applications.

当米奇,阿拉丁和复仇者联盟解决了问题的高品质内容时(不是太棒了!),我们专注于尝试使用不同的自动化框架来对应用程序进行全面的质量分析。

This blog talks about our journey in choosing XCUITest as the Mjölnir (Hammer of Thor, if you were still wondering) of choice.

该博客讨论了我们选择XCUITest作为Mjölnir ( 雷神之锤,如果您仍然想知道的话 )的过程。

学会取消学习 (Learn to Unlearn)

Like most others in the industry, we evaluated Appium as a tool of choice. We quickly found issues with automation-at-scale, going deeper than the surface tests and manipulating the Application Under Test (AUT). Of course, Appium works handsomely on blackbox kind of testing but then, we weren’t looking to stop at surface tests.

与行业中的大多数其他公司一样,我们将Appium视为首选工具。 我们很快发现了大规模自动化的问题,它比表面测试要深入得多,并且要处理被测应用程序(AUT)。 当然,Appium在黑盒测试方面做得不错,但是,我们并不想停止表面测试。

Some details on why Appium didn’t work for us:

有关为何Appium对我们不起作用的一些详细信息:

  • Complex Application Design + Flakier at Scale: Our application deals with multi level layered architecture of UI and it was difficult to recognise elements on Appium. Further we found ourselves restricted in simulating application states and the faster we wanted the test to run, the flakier it became.

    复杂的应用程序设计+ Flakier的规模:我们的应用程序处理UI的多层体系结构,很难识别Appium上的元素。 此外,我们发现自己在模拟应用程序状态方面受到限制,并且我们希望测试运行得越快,它变得越发脆弱。

  • Inability to mock unnecessary steps: Since Appium works as black box, it is not easy to reduce the use of redundant flows when the objective of the test is something else.

    无法模拟不必要的步骤:由于Appium充当黑匣子,因此当测试的目标是其他目的时,减少冗余流的使用并不容易。

  • Dynamic control on features: Appium can not control the behaviour of a feature to create the test scenario dynamically on runtime.

    动态控制功能: Appium无法控制功能的行为以在运行时动态创建测试方案。

  • Tests are slow: Most importantly, Appium is built to support multiple platforms and languages, hence tests are slower in general.

    测试速度很慢:最重要的是,Appium构建为支持多种平台和语言,因此测试速度通常较慢。

  • Onboarding Curve: We needed a framework that was frictionless in onboarding our team, so that everyone could contribute to the effort. XCUITest was relatively easier to onboard our team.

    入职曲线:我们需要一个在加入我们的团队时保持平稳的框架,以便每个人都可以为这项工作做出贡献。 XCUITest相对容易加入我们的团队。

Image for post

快速失败,快速学习! (Fail Fast, Learn Fast!)

Automation is not a need, but a habit, so we started to channelise our habits in the correct direction.

自动化不是一种需要,而是一种习惯,因此我们开始朝着正确的方向引导我们的习惯。

解码迷宫: (Decode the labyrinth:)

With the intent of moving fast and releasing often, it was needed that our tests are focussed and minimal enough to give us the required confidence in the product or feature.

为了快速移动和经常发布,我们的测试重点是集中且最小化,以使我们对产品或功能具有所需的信心。

We wanted a medium to achieve our aspirations of:

我们想要一种媒介来实现我们的愿望:

  • Functional tests for focussed validation

    针对重点验证的功能测试
  • Mocking of components to deeply test interactions

    模拟组件以深入测试交互
  • Easy integration with CI to get continuous feedback

    易于与CI集成以获得持续的反馈
  • Powerful enough to handle complexity

    功能强大,足以应付复杂性
  • Stable enough to reduce flakiness

    足够稳定以减少脱皮

切换到苹果的XCTest框架: (Switch to Apple’s XCTest framework:)

We started using Apple’s XCUITest framework to write functional test cases. The strategy was to push testing deep into the process and system so that we fail early and reduce the turnaround time of a bug fix.

我们开始使用Apple的XCUITest框架编写功能测试用例。 该策略是将测试深入到流程和系统中,以便我们尽早失败并减少错误修复的周转时间。

Image for post

I know, Thanos made sense most of the time.

我知道,Thanos大多数时候都有意义。

With this decision, we invested in building the skill set of writing Swift code within the team and as we realised the full potential of the framework over the period of time, we started reaping the benefits of XCTest being native.

有了这个决定,我们投资了团队内部的技能来编写Swift代码。随着我们认识到框架在一段时间内的全​​部潜力,我们开始从XCTest的本机中受益。

Some of them were:

其中一些是:

  • Code is maintained inside the project itself, hence the maintenance is pretty easy with Xcode.

    代码在项目本身内部维护,因此使用Xcode维护非常容易。
  • Developers get a sense of what is being tested and how, which helps them write test driven code.

    开发人员可以了解正在测试的内容以及测试的方式,这有助于他们编写测试驱动的代码。
  • Tests have great control over the features and they have the ability to tweak the environment as per the requirements.

    测试可以很好地控制这些功能,并且可以根据要求调整环境。
  • Tests are much faster and reliable.

    测试更快,更可靠。
  • Tests are more targeted to a functional flow

    测试更针对功能流程
  • It is easier for any developer to run a subset of test while developing a feature so the quality gate is put on the first entry.

    任何开发人员在开发功能时都更容易运行测试的子集,因此将质量门放在第一位。

Here is a diagram that explains the architecture of our suite:

以下图表说明了我们套件的体系结构:

Image for post
Image for post

Okay. Enough talking.

好的。 聊够了。

我们是怎么做的? (How did we do it?)

问题陈述: (Problem statement:)

Let’s take a sample test:

让我们进行样本测试:

Image for post

We wanted to run this test in multiple geographies and on different customer subscriptions to validate that our news clips are working fine.

我们希望在多个地区和不同的客户订阅中运行此测试,以验证我们的新闻剪辑是否工作正常。

To achieve that, we designed a test suite that can process different configurations of the application and be smart enough to adjust accordingly.

为此,我们设计了一个测试套件,该套件可以处理应用程序的不同配置,并且足够聪明以进行相应的调整。

Few dynamic configurations needed were:

所需的动态配置很少:

  • Geographical regions: US, UK, Canada etc

    地理区域:美国,英国,加拿大等
  • Environment: Production, Pre-production, QA etc

    环境:生产,预生产,质量检查等
  • User subscription type: Free, VIP, Premium

    用户订阅类型:免费,VIP,高级
Image for post

And the hero in us nailed it right.

我们中的英雄把它钉得对。

启动参数和环境变量: (Launch arguments and environment variables:)

XCUITest lets us pass string arguments or key,value pairs as launch arguments and environment variables respectively to the application under test.

XCUITest允许我们分别将字符串参数或键,值对作为启动参数和环境变量传递给被测应用程序。

Using this approach, we gained greater control over the application as we could make the application behave as we want as per our requirements at run time.

使用这种方法,我们可以对应用程序进行更大的控制,因为我们可以使应用程序在运行时按照要求运行。

测试计划: (Test Plans:)

Another great utility that XCUITest provides for efficient management and configuration of test runs is XCTestPlan.

XCUITest提供的另一个有效的实用工具是XCTestPlan,它可以有效地管理和配置测试运行。

Image for post

As shown above, using XCTestPlan, We created different suites of tests. With each suite, we added different configurations that we wanted to run the tests on.

如上所示,我们使用XCTestPlan创建了不同的测试套件。 对于每个套件,我们添加了要对其运行测试的不同配置。

For eg: We identified a collection of tests and added them to a new XCTestPlan called smoke test. Later we added configurations for each region based on the user type i.e. Smoke-US-PremiumUser and Smoke-UK-VIPUser.

例如:我们确定了测试的集合,并将它们添加到称为烟雾测试的新XCTestPlan中。 后来,我们根据用户类型(即Smoke-US-PremiumUser和Smoke-UK-VIPUser)为每个区域添加了配置。

Image for post

The image above shows how we are able to run one test on different configurations with minimal effort.

上图显示了我们如何能够以最小的努力对不同的配置运行一项测试。

结果 (Outcomes)

With the above plan and execution strategy, we saw great results in fast tracking our quality cycles and hence building the confidence in the product to release often.

通过上述计划和执行策略,我们在快速跟踪质量周期并因此建立了对经常发布产品的信心方面取得了巨大成果。

分布式测试和并行运行: (Distributed tests and parallel runs:)

Using XCUITest’s parallel simulator runs, we are able to do painless distribution of tests across simulators and hence reducing the run time of the suite.

使用XCUITest的并行模拟器运行,我们可以在模拟器之间进行无痛的测试分配,从而减少套件的运行时间。

Image for post

作为Github检查运行测试: (Test runs as Github check:)

We identified the subset of tests that can give us enough confidence to merge new code and let it run on simulators. This reduced the occurrence of compilation errors and dead builds reaching the QA cycles.

我们确定了测试的子集,这些子集可以使我们有足够的信心来合并新代码,并使其在模拟器上运行。 这减少了编译错误的发生和达到QA周期的不可靠构建。

One-size-fits-all:

一应俱全:

Image for post

With a proven framework built on iOS it was a cake walk to replicate our learnings and strategies to other Apple platforms like iPad and Apple TV.

借助在iOS上构建的可靠框架,将我们的学习和策略复制到其他Apple平台(如iPad和Apple TV)非常容易。

We built a similar solution for our Apple TV application and et voilà !

我们为Apple TV应用程序构建了类似的解决方案,等等!

Image for post
Image for post

As you say Iron man, let’s wrap up.

正如您说的钢铁侠,让我们结束吧。

简而言之 (In a Nutshell)

All these components come together for a single goal, raise the quality bar of our releases to infinity and beyond. In this conquest, XCUITest has been a paramount contributor to deliver a complete viewing experience on Apple platforms.

所有这些组件都汇集在一起​​以实现一个目标,将我们发行版的质量标准提高到了无限甚至更高。 在这一征服中,XCUITest一直是在Apple平台上提供完整观看体验的最重要贡献者。

With the belief of “Release fast, Release often”, we make use of these smaller and effective quality gates to make the release process completely automated, but that’s a topic for another blog.

秉持“快速发布,经常发布”的信念,我们利用这些较小且有效的质量门使发布过程完全自动化,但这是另一个博客的主题。

For now, keep binging for more awesomeness.

就目前而言,继续加油以获得更多真棒。

Till next time…

直到下一次…

Image for post

翻译自: https://blog.hotstar.com/using-apples-testing-mj%C3%B6lnir-xcuitest-9c3bad88ae4b

苹果公司30%

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值