uitest_您在Swift中的第一个UITest

uitest

测试中 (TESTING)

什么是自动UITest? (What Is Automated UITest?)

When we speak about testing, we usually think about unit testing. However, there is another kind of test that is extremely powerful and useful in the app world: UITests.

当谈到测试时,我们通常会考虑单元测试。 但是,在应用程序世界中还有另一种功能极其强大且有用的测试:UITests。

The goal of these tests is to verify that your UI is behaving as expected: the buttons are in the correct state, the strings are styled correctly and the navigation happens as we code it.

这些测试的目的是验证您的UI行为是否符合预期:按钮处于正确的状态,字符串的样式正确,并且导航在我们进行编码时发生。

The body of the test simulates a user that interacts with the UI, causing the app to evolve over time and allowing us to assert some condition that we want to be true during the app execution.

测试的主体模拟了与UI交互的用户,从而导致应用程序随着时间的推移而发展,并允许我们断言某些条件,这些条件要求我们在应用程序执行期间必须为真。

为什么要执行自动UITest? (Why doing Automated UITest?)

As all the testing activities, writing proper UITests takes time. However, this time will save us many headaches in the future, and it will also save more time than it consumes, in the long run.

作为所有测试活动,编写适当的UITests需要时间。 但是,这段时间将来将为我们节省很多麻烦,从长远来看,还将节省比其所消耗的时间更多的时间。

Writing automated UITests has numerous benefits, especially in cases where the app is becoming really big and, potentially, hard to maintain. Some of these benefits:

编写自动化的UITests有很多好处,尤其是在应用程序变得非常大且可能难以维护的情况下。 其中一些好处:

  • Prevent the need to test old features. In an agile environment, we are creating new features every couple of weeks. However, developers are a bit paranoid: they will ask their QA friends to test the whole app, every time, to avoid regressions. Automated UITest can be used to go through the most common use cases automatically, preserving the sanity of mind of both developers and QA.

    无需测试旧功能。 在敏捷的环境中,我们每两周创建一次新功能。 但是,开发人员有些偏执:他们会要求QA朋友每次都测试整个应用程序,以避免性能下降。 可以使用自动化的UITest自动浏览最常见的用例,从而保持开发人员和质量检查人员的头脑清醒。

  • Encode use case knowledge. UITests allows us to see how the app behaves when a sequence of events occurs. This can be useful to keep track of common use cases and to verify that they don’t break down every time we modify the app.

    编码用例知识。 UITests允许我们查看事件序列发生时应用程序的行为。 这对于跟踪常见用例并确保每次我们修改应用程序时它们不会崩溃都非常有用。

  • Test UI Performances. Assuming that your app has to perform some heavy UI operations, like scrolling through a big list of images, we can use UITests to measure how much it takes to perform these operations and if there are regressions or not.

    测试UI性能。 假设您的应用必须执行一些繁重的UI操作,例如滚动浏览一大堆图像,我们可以使用UITests来衡量执行这些操作所需的时间以及是否存在回归。

  • Check localizations. Assuming that your app is localized, we can automatically check whether some strings are cut with an ellipsis or not.

    检查本地化 。 假设您的应用程序已本地化,我们可以自动检查某些字符串是否用省略号切掉。

These are just some of the advant

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值