Software testing has gradually evolved in the past few decades. In the past, teams were accustomed to the waterfall methodology: Everything was sequential, from requirements to product deployment.

软件测试在过去几十年中逐渐发展。 在过去,团队习惯于瀑布方法:从需求到产品部署,一切都是顺序的。

Only after the development phase was completed did the testers got their hands on the product. Historically, testers would find a number of bugs in this phase, and it would take a lot of redesign and rework to fix them. This resulted in a lot of wastage, from time to effort and cost, plus team morale.

只有在开发阶段完成后,测试人员才能获得产品。 从历史上看,测试人员会在此阶段发现许多错误,需要进行大量的重新设计和返工才能修复它们。 这导致了大量的浪费,从时间到精力和成本,再加上团队士气。

But in the current state of testing, most companies are following Agile processes, such as XP, Scrum, Kanban, or some variation of these. The main goal is to find bugs fast, fix them quickly, and release software faster.

但在当前的测试状态下,大多数公司都在遵从敏捷流程,例如XP,Scrum,看板或其中的一些变体。 主要目标是快速发现缺陷,快速修复缺陷并更快地发布软件。

In order to achieve this goal, there is a huge need to complement the already existing manual testing process with automated testing. This is a vital component of Continuous Integration (CI), Continuous Delivery (CD), and DevOps, which most teams are now following to make their Software Development Life Cycle (SDLC) process more lean and effective.

为了实现这一目标,通过自动化测试来补充现有的手动测试过程,这是十分必要的。 这是持续集成(CI),持续交付(CD)和DevOps的重要组成部分,大多数团队正在遵循这些,使其软件开发生命周期(SDLC)流程更加精简和有效。

Various tools and frameworks have evolved in the past decade to help with automated testing, but one approach worth talking about is the use of Artificial Intelligence (AI) in test automation.


AI test automation

De-Mystifying Artificial Intelligence 去神秘化的人工智能

Let’s first take a step back and de-mystify AI. At its most basic level, AI is a technology that can comprehend, sense, and learn, and use computers to solve problems typically requiring human intelligence and understanding.

让我们先退后一步,让AI去神秘化。 在最基本的层面上,AI是一种能够理解,感知和学习的技术,并且使用计算机来解决通常需要人类智能和理解的问题。

Another way of looking at it is, AI applies human skills and tendencies to inanimate objects or ideas. Much like automation, AI makes it possible for technology to complete real human tasks.

另一种看待它的方式是,AI将人类技能和倾向应用于无生命的物体或想法。 与自动化非常相似,AI使技术可以完成真正的人工任务。

Contrary to popular opinion, AI is neither a distant reality nor a concept based on the plots of science fiction; instead, it has infiltrated the technology scene and is fueling the innovations that touch our daily lives. From chat bots posing as customer service representatives to search results and traffic predictions, on any given day, AI is all around us.

与流行观点相反,人工智能既不是遥远的现实,也不是基于科幻小说的概念; 相反,它渗透了技术领域,并推动了触及我们日常生活的创新。 从作为客户服务代表的聊天机器人到搜索结果和流量预测,在任何一天,人工智能就在我们身边。

Here are some mind blowing statistics about AI adoption: 以下是关于AI使用的一些令人兴奋的统计数据

  • According to a recent study by Narrative Science, 61% of businesses implemented AI in some way in 2017. The adoption rate is only growing in 2018.  根据Narrative Science最近的一项研究,61%的企业在2017年以某种方式实施了人工智能。这个使用率是仅在2018年的增长。
  • Another study from Juniper Research has found that global retailer spending on AI will reach $7.3 billion per annum by 2022, up from an estimated $2 billion in 2018. Juniper Research的另一项研究发现,到2022年,全球零售商在人工智能的支出将达到每年73亿美元,高于2018年估计的20亿美元。
  • CMO article claims that by 2035, AI will help to improve labor productivity by 40% and enable people to make efficient use of their time. 一篇CMO文章称,到2035年,人工智能将帮助提高40%的劳动生产率,并使人们能够有效利用他们的时间。

Influence of AI in Test Automation AI在测试自动化中的影响

AI has already started influencing test automation in various ways, resulting in a considerable amount of time saved in authoring and executing tests, creating more stable tests, finding bugs fast, and releasing software much faster to meet customer demands. Here are some of the ways this is happening.

AI已经开始以各种方式影响测试自动化,从而在设计和执行测试中节省了大量时间,创建了更稳定的测试,快速发现缺陷,以及更快地发布软件以满足客户需求。 以下是正在发生的一些方面。

Faster and More Stable UI Tests 更快,更稳定的UI测试

As part of the continuous testing process, software development teams have unit tests, service/API level tests, and user interface (UI) tests. The common problem with UI tests specifically is that they are slow and brittle and involve high maintenance. AI can avoid this with the use of Dynamic Locators.

作为持续测试过程的一部分,软件开发团队有单元测试,服务/ API级别测试和用户界面(UI)测试。 UI测试的常见问题是它们缓慢而脆弱,并且涉及大量维护。 AI可以通过使用动态定位器来避免这种情况。

This is a strategy by which the AI parses multiple attributes of each and every element the user interacts with in the application and creates a list of location strategies, in real time. So, even if an attribute of an element changes, the tests do not fail; instead the AI detects this problem and goes to the next best location strategy to successfully identify the element in the page.

这是一种策略,通过该策略,AI解析用户在应用程序中与之交互的每个元素的多个属性,并实时创建位置策略列表。 因此,即使元素的属性发生变化,测试也不会失败; 相反,AI会检测到此问题并转到下一个最佳位置策略,以成功识别页面中的元素。

In this way, the tests are more stable, and as a result, the authoring and execution of tests is really fast as well.


AI test automation

Reducing Maintenance and Eliminating Flaky Tests 减少维护和消除不稳定测试

One of the most common problems with test automation is maintenance.


For example, say we have 100 automated tests running on a daily basis to ensure the main functionalities of the application are still stable; What if the next day we come back to work and find that half of the tests have failed? We would need to spend considerable amounts of time to troubleshoot the failures and investigate what actually happened. This involves figuring out ways to fix the failures and implement the fixes. Then, we re-run the automated tests to ensure everything passes. Does this ring a bell?

例如,假设我们每天运行100次自动化测试,以确保应用程序的主要功能仍然稳定; 如果第二天我们重新开始工作并发现一半的测试失败了怎么办? 我们需要花费大量时间来排除缺陷并调查实际发生的情况。 这涉及找出修复缺陷和实施修复。 然后,我们重新运行自动化测试以确保一切都通过。 这会响铃告警吗?

AI can avoid issues like this due to its self-healing mechanism. It can start detecting problems in the tests before they even occur, thus proactively fixing tests instead of us reacting to them.

由于其自我修复机制,AI可以避免这样的问题。 它可以在测试发生之前就开始检测测试中的问题,从而主动修复测试而不是我们对它们做出反应。

Based on the number of times the tests have run, the AI can figure out which tests are stable or flaky. As a result, it can give us data on what tests need to be modified to ensure test runs are stable.

根据测试运行的次数,AI可以确定哪些测试是稳定的还是不稳定的。 因此,它可以为我们提供有关哪些测试需要被修改的数据,以确保测试运行稳定。

Finally, based on large numbers of test runs, AI can optimize the wait times used in tests to wait for the pages to load and also can handle tests running on different resolutions. All of this adds up to a considerable decrease in the time spent on maintenance of tests and helps to solve one of the biggest bottlenecks of continuous testing.

最后,基于大量的测试运行,AI可以优化测试中等待页面加载的等待时间,还可以处理在不同分辨率下运行的测试。 所有这些都大大减少了维护测试所花费的时间,并有助于解决连续测试的最大瓶颈之一。

AI test automation

Continuous Learning from Production Data 从生产数据中不断学习

In this fast-paced environment where customer is king, it is important to observe and learn how customers use our product. This is true whether you have a web, mobile, or desktop application.

在客户为王的快节奏环境中,观察和了解客户如何使用我们的产品非常重要。 无论您拥有网络,移动设备还是桌面应用程序,都是如此。

With autonomous testing, we now have a way for AI to start observing and learning how our customers are using the product. Based on this, it can start creating tests based on real user data.

通过自主测试,我们现在可以让AI开始观察和了解客户如何使用该产品。 基于此,它可以开始基于真实的用户数据创建测试。

It is smart enough to identify commonly used actions such as logging in/out of the application and cluster them into reusable components. Then it injects these newly created reusable components into our tests as well. Now, all of a sudden we already have actual tests written by the AI based on real data, along with reusable components that can be used within other tests as well.

它足够聪明,可以识别常用的操作,例如登录/注销应用程序,并将它们集中到可重用的组件中。 然后它将这些新创建的可重用组件注入我们的测试中。 现在,突然间我们已经有了基于AI编写的,基于真实数据的实际测试,以及可以在其他测试中使用的可重用组件。

AI test automation

This reminds me of a quote from the great Steve Jobs: “Start with the customer experience and work backwards.”


Removing Dependencies 删除依赖项

Another challenge of test automation is writing tests for a system that may have dependencies on other modules that may or may not have been implemented yet. Usually during these times, we mock responses from a server or database. Now AI can help to do this for us.

测试自动化的另一个挑战是为一个系统写测试,这个系统依赖于已经或尚未实现的其他模块。 通常在这些时间,我们mock来自服务器或数据库的响应。 现在AI可以帮助我们做到这一点。

Once we have authored some tests and have run them consistently for a period of time, the AI can start recording all the server responses. The next time we run the tests, instead of talking to a server or database, the test will access the stored responses (which was facilitated with the help of AI) and will continue to run without any obstacles.

一旦我们编写了一些测试,并且持续运行它们一段时间,AI就可以开始记录所有服务器响应。 下次我们运行测试,不再与服务器或数据库通信,测试将访问存储的响应(在AI的帮助下),并将继续运行没有任何障碍。

As a result, the tests run much faster, since the delay in waiting for a response is eliminated and the need to rely on a physical database or server has completely been erased.


AI test automation

Ease of Authoring and Executing Tests 易于编写和执行测试

Some of the biggest obstacles keeping companies from moving forward with automation is the amount of time and effort it takes to author and execute tests with the chosen tool or framework and the availability of skilled resources to do this task.


Even when companies decide to move forward with automated testing, teams have to spend considerable amounts of time authoring and executing tests due to complexity of the application, tools available, and the programming language used.


Now, there are AI-based tools that help to mitigate these problems. Tests that used to take one week to author and execute can now be done in a matter of hours using AI. This is possible with the use of Dynamic Locators and the ability to easily create reusable components, do data-driven testing, author and execute tests quickly, and integrate CI/CD systems easily with public and private grids. As a result, we are able to have reliable tests, more test coverage, less maintenance, and faster release cycles.

现在,有一些基于AI的工具可以帮助缓解这些问题。 过去需要一周时间来设计和执行的测试,现在可以在几个小时内使用AI完成。 这可以通过使用动态定位器以及轻松创建可重用组件,快速执行数据驱动测试,设计和执行测试以及轻松地将CI / CD系统与公共和专用网格集成。 因此,我们能够进行可靠的测试,更多的测试覆盖,更少的维护和更快的发布周期。

Also, this has opened up a new era in test automation where nontechnical people can get involved in test automation as well. This helps to increase collaboration within teams and encourages everyone to own the test automation effort. AI is now bringing a whole-team approach to test automation.

此外,这开辟了测试自动化的新纪元,非技术人员也可以参与测试自动化。 这有助于增加团队内的协作,并鼓励每个人拥有测试自动化工作。 AI现在正在为测试自动化带来整个团队的方法。

AI test automation

Releasing at the Speed of Development 加快研发速度

With AI powering the transition to autonomous testing, reducing the maintenance to a minimum, and creating more reliable tests, the ability for teams to release faster is better than ever.


With AI and autonomous testing, quality assurance (QA) can focus on exploratory tests, while a big portion of the tests are continuously created and updated automatically. Now, your release frequency is only limited by how quickly your developers can code. It is also easier for QA to maximize user coverage by connecting authoring of tests with production apps mapping to real user flows.

通过AI和自主测试,质量保证(QA)可以专注于探索性测试,而大部分测试可以自动创建和更新。 现在,您的发布频率仅受开发人员编码速度的限制。 通过将测试设计与映射到实际用户流的生产应用程序连接起来,QA也可以更轻松地实现最大化用户覆盖。

Now, we have the ability to take a risk-based approach and base our decisions on real data. Most of all, we are ahead of the game by proactively fixing issues instead of reacting to them, because of the self-healing mechanism of the AI.

现在,我们有能力采用基于风险的方法,并根据实际数据做出决策。 最重要的是,由于人工智能的自我修复机制,我们通过主动解决问题而不是对它们作出反应,来处于领先地位。

Also, we are now able to create more user scenarios in short period of time. This means you can find bugs fast and release faster. The future of testing has only become brighter with AI.

此外,我们现在能够在短时间内创建更多用户场景。 这意味着您可以快速找到缺陷并快速发布。 因为AI,测试前景变得更加光明。

If you have experienced or heard of other ways to implement AI in test automation, please share your thoughts below in the comments section.



Raj Subramanian is a former developer who moved to testing to focus on his passion. Raj currently works as a Developer Evangelist for, that provides stable self-healing AI based test automation to enterprises such as Netapp, Swisscom,Wix and Autodesk. He also provides mobile training and consulting for different clients. He actively contributes to the testing community by speaking at conferences, writing articles, blogging, making videos on his youtube channel and being directly involved in various testing-related activities. He currently resides in Chicago and can be reached at and on twitter at @epsilon11. He actively blogs on and his website . His videos on testing, leadership and productivity can be found here.

Raj Subramanian是一名前开发人员,他由于自己的热情转向测试领域。 Raj目前担任Testim.io的开发人员宣传员,为Netapp,Swisscom,Wix和Autodesk等企业提供稳定的自我修复AI测试自动化。 他还为不同的客户提供移动培训和咨询服务。 他通过在会议上发表演讲,撰写文章,写博客,在他的YouTube频道上制作视频以及直接参与各种与测试相关的活动,积极地为测试社区做出贡献。 他目前居住在芝加哥,可以通过raj@testim.io和Twitter上的@ epsilon11与他联系。 他积极在www.testim.io和他的网站www.rajsubra.com上发表博客。 他的测试,领导力和生产力视频可以在这里找到。

* 注:本文来自网络投稿,不代表本站立场,如若侵犯版权,请及时知会删除