selenium基础教程

HelloFresh values a strong user experience, so proper testing is at the core of how we build great software. With a growing customer base and added code complexity, our Platform team realized our existing testing infrastructure was not growing with the needs of our customers and internal stakeholders. In this post, I will share our journey to building an Elastic selenium infrastructure using aerokube stack on and more various tools around this stack.

HelloFresh重视强大的用户体验,因此正确的测试是我们构建出色软件的核心。 随着客户群的增加和代码复杂性的增加,我们的平台团队意识到我们现有的测试基础架构并未随着客户和内部利益相关者的需求而增长。 在本文中,我将分享使用aerokube堆栈以及围绕该堆栈的更多各种工具来构建ElasticSelenium基础架构的过程 。

In HelloTech, we design software according to a services oriented architecture, which means hundreds of different services have their own set of tests. Before releasing key components of the system, we want to check that all our services work together as a single system and deliver the best user experience to our customers.

在HelloTech中,我们根据面向服务的体系结构设计软件,这意味着数百种不同的服务都有自己的测试集。 在发布系统的关键组件之前,我们希望检查我们所有的服务是否可以作为一个系统一起工作,并为我们的客户提供最佳的用户体验。

In our case the tests themselves were not a pain point, we write great tests ;). The problem was our infrastructure. We evaluated solutions based on the following criteria: ease of use, reliability, cost effectiveness, and security.

在我们的案例中,测试本身并不是一个痛点,我们编写了出色的测试;)。 问题是我们的基础设施。 我们根据以下标准评估了解决方案:易用性,可靠性,成本效益和安全性。

我们的选择和实施细节: (Our choice and implementation details:)

为错误添加更多上下文 (Adding more context to the errors)

Usually selenium tests expose only UI base errors (e.g NoSuchElementException and more as described here: link). In the scope of reasons why such errors happened we would like to add more tools that could help in detection why an element is not visible or why something is not loaded, because raw selenium errors are not reflecting the real reasons of why something is not loading as it was expected. Platform team decided to add more tools to our selenium stack, and the first choice was to add a proxy for recording http(s) calls being made during the autotest session. To achieve this, used a fork of browsermob_proxy which gave us access to the new testing artifact and the Har file.

通常,Selenium测试仅暴露UI基本错误(例如NoSuchElementException以及此处所述的更多链接 : link )。 在发生此类错误的原因范围内,我们希望添加更多工具,以帮助检测为何元素不可见或为何未加载某些内容,因为原始Selenium错误并未反映出为何未加载某些内容的真实原因。如预期的那样。 平台团队决定向我们的Selenium堆栈中添加更多工具,并且第一选择是添加一个代理,以记录在自动测试会话期间进行的http(s)调用。 为了实现这一目标,使用了一个浏览器mob_proxy的分支,它使我们可以访问新的测试工件和Har文件。

报告中 (Reporting)

This also enabled us to build some reporting around it. Proxy is reporting 50x status codes to the log collector where we parse them and compose the report based on status codes and end points. We are sending this report daily to the slack channel where all parties involved in development can review and analyse the failures. Example of daily report available on screenshot below:

这也使我们能够围绕它构建一些报告。 代理正在向日志收集器报告50倍的状态代码,我们在其中解析它们并根据状态代码和端点编写报告。 我们每天都会将此报告发送到备用渠道,开发中涉及的所有各方都可以在该渠道中查看和分析故障。 下面的屏幕快照提供了每日报告的示例:

Example of daily report
每日报告示例

Besides this, we integrate reason of failures to our automated test report, so it’s now clearly visible where and why error happened.

除此之外,我们还将失败原因整合到我们的自动化测试报告中,因此现在可以清楚地看到发生错误的位置和原因。

Example of automated test report
自动测试报告示例

扩展我们的Selenium基础设施 (Scaling our selenium infrastructure)

Initially, we had one EC2 instance (“m5.2xlarge” with 8 vCPU cores and 32 GB of memory) handling all testing requests and aspects of our infrastructure. Additionally, we’re using selenoid, provided by aerokube, to run our tests. Unfortunately, we encountered some scalability issues with this solution; as more services were added, the load on instance kept increasing and soon it was not enough on a company level. We needed to investigate potential alternatives to improve our testing infrastructure’s scalability.

最初,我们有一个EC2实例(“ m5.2xlarge”,带有8个vCPU内核和32 GB内存),用于处理所有测试请求和基础架构的各个方面。 此外,我们使用aerokube提供的selenoid来运行测试。 不幸的是,我们在此解决方案中遇到了一些可伸缩性问题。 随着更多服务的添加,实例上的负载不断增加,很快在公司级别上还不够。 我们需要研究潜在的替代方案,以改善测试基础架构的可扩展性。

As an initial step, we decided to use small machines to run selenoid nodes with available browser types (chrome/firefox/opera etc.) instead of one big machine. We selected “t3a.small” instances. To build automation for these instances we used terraform + packer, both tools helped us to provision instances with preinstalled software and configure in a predictable way. We created an autoscaling group which controls the number of selenoid nodes inside this group. Auto Scaling group having scheduled triggers for a cost efficient way of using resources, it means that during business hours we add more nodes to the auto scaling group and during night we decrease this number. In addition we also built a small lambda function which is calling status end point of our main orchestrator for selenium based requests (grid router). The lambda function is only adding nodes to the autoscaling group and after the business hours, they are removed by scheduled autoscaling actions.

作为第一步,我们决定使用小型计算机来运行具有可用浏览器类型(chrome / firefox / opera等)的类Selenium节点,而不是一台大型计算机。 我们选择了“ t3a.small”实例。 为了为这些实例构建自动化,我们使用了terraform + packer ,这两种工具都可以帮助我们为实例配备预安装的软件并以可预测的方式进行配置。 我们创建了一个自动缩放组,该组控制该组内的类神经节的数量。 Auto Scaling组已安排了触发器,以节省成本的方式使用资源,这意味着在工作时间内,我们向Auto Scaling组添加了更多节点,而在晚上,我们减少了此数量。 此外,我们还构建了一个小的lambda函数,该函数为基于Selenium的请求(网格路由器)调用主协调器的状态端点。 lambda功能仅将节点添加到自动伸缩组,并且在营业时间之后,将通过计划的自动伸缩操作将其删除。

For orchestration of selenium requests we are using a solution based on aerokube ggr. The only difference from the original ggr is that we have added a flag called “uniformDistribution”. This flag is used when ggr is not able to find a free selenoid host to schedule a test run, in this case our forked version of ggr is calling status end point for underlying selenoid nodes and looking for the least loaded node to schedule the session. When scaling activity is happening we are using consul for rendering ggr template, discovery of new selenoid nodes and reload configuration of ggr to add or remove nodes. Consul is running on both ggr and selenoid nodes and responsible to register nodes and build the quota file on ggr hosts. Example of consul template:

对于Selenium的编排要求,我们使用的是基于aerokube的解决方案GGR 。 与原始ggr的唯一区别是我们添加了一个名为“ uniformDistribution”的标志。 当GGR是不是能找到一个免费的selenoid主机调度试运行,在这种情况下,我们的分叉的版本,使用该标志GGR呼吁地位终点底层selenoid节点,寻找最小负载的节点来安排会议。 当发生扩展活动时,我们将使用领事来渲染ggr模板,发现新的类瘤节点并重新加载ggr的配置以添加或删除节点。 Consul在ggr和selenoid节点上都运行,并负责在ggr主机上注册节点并构建配额文件。 领事模板示例:

Consul template for ggr
ggr的领事模板

费用 (Costs)

After adding the above steps of using consul and auto scaling groups we were able to reduce the costs of selenoid infrastructure by using spot instances to run the selenoid nodes. Auto scaling group sends notifications about upcoming spot instance interruption (2 mins ahead), thus consul removes instance from pool and the testing session gets cancelled. For notifications, we used sns topic to wait for messages about interruption (more information about sns and how to setup it available in official docs). The screenshot below illustrates the cost of running the selenium infrastructure; usually we are limiting our autoscale group to 40 selenoid nodes. The costs of previously used to run selenoid “m5.2xlarge”-machine were about 313 usd per month for single machine which were able to launch less number of parallel sessions, and now with new setup costs decreased in average to 135usd per month.

添加了使用领事和自动伸缩组的上述步骤后,我们能够通过使用竞价型实例运行Selenium素节点来降低Selenium素基础设施的成本。 自动伸缩组会发送有关即将发生的竞价型实例中断的通知(提前2分钟),因此领事将从池中删除实例,并取消测试会话。 对于通知,我们使用sns主题等待有关中断的消息(有关sns以及如何在官方文档中进行设置的更多信息)。 下面的屏幕快照说明了运行Selenium基础架构的成本; 通常,我们将自动缩放组限制为40个类神经节。 以前用于运行Selenium鼓“ m5.2xlarge”机器的成本约为单台机器每月313美元,能够启动较少数量的并行会话,而现在新设备的平均成本降低至每月135美元。

Selenium based infrastructure cost per month with new infrastructure
新基础架构每月基于Selenium的基础架构成本

监控方式 (Monitoring)

On every selenoid node and every ggr we have installed a telegraf agent which is producing metrics in prometheus format. Those are scrapped by prometheus, and based on this data, we build a grafana dashboard and alerting for selenoid:

在每个Selenium状体节点和每个ggr上,我们都安装了Telegraf代理,该代理以Prometheus格式生成度量。 那些被普罗米修斯报废了,并基于此数据,我们构建了一个grafana仪表板并警告类Selenium素:

Selenoid infrastructure usage dashboard
Selenoid基础设施使用情况仪表板

Abstract schema of services used to build solution

用于构建解决方案的服务的抽象架构

HelloFresh selenium infrastructure schema.
HelloFreshSelenium基础架构。

结论 (Conclusion)

As a Platform team, we have built a scalable and efficient infrastructure based on Aerokube’s widely known Selenoid. With this solution, we are now able to deliver better end to end products to our customers and provide a scalable and reliable platform for end-to-end test execution. We hope this article can help you to build a strong and cost efficient solution on top of well known tools and help your developers trace failures and deliver quality features.

作为平台团队,我们基于Aerokube广为人知的Selenoid建立了可扩展且高效的基础架构。 通过此解决方案,我们现在能够为客户提供更好的端到端产品,并为端到端测试执行提供可扩展且可靠的平台。 我们希望本文可以帮助您在众所周知的工具之上构建强大且经济高效的解决方案,并帮助您的开发人员跟踪故障并提供高质量的功能。

翻译自: https://engineering.hellofresh.com/elastic-selenium-infrastructure-9b62dc1c84fa

selenium基础教程


http://www.taodudu.cc/news/show-3455027.html

相关文章:

  • open*vpn 配置DHCP 地址池
  • centos 搭建open v批n以及使用 + frp
  • openvpn集成openldap认证
  • OpenVpnCentos7脚本
  • ChinaSkills技能大赛网络系统管理Debian模块||RouterSrv的openvpn配置详解
  • 已解决: openvpn Authenticate/Decrypt packet error: packet HMAC authentication failed
  • CentOS搭建Open服务(集成openldap认证)
  • centos安装配置OPEN*PN
  • 关于免流搭建教程免流服务内容
  • 【Docker】docker搭建open虚拟专用通道服务
  • centos7.x openvpn+freeradius认证daloradius管理
  • 虚拟机(centos7)安装openvpn
  • centos部署OpenVpn(一)
  • frp+open*pn实现访问内网
  • centos 安装openvpn
  • Debian10搭建open虚拟专用网
  • python中的pro什么意思_荣耀20 PRO现货发售 华为官方解析何为Python爬虫
  • abap语法高亮编辑器 hippo edit SAP
  • 轻松DIY智能硬件,开源电子原型平台Hippo-ADK
  • ASP.NET开源框架之HIPPO技术内幕(二)--Meta-Data驱动
  • ​闻所未闻的远程工作见解,听听看?
  • html5 游戏 动画设计,设计师必看的10个HTML5动画工具
  • 一起看看Ubuntu21.04有什么好玩的更新
  • hippo 开发板_HippoEDIT(文本编辑器)
  • ASP.NET开源框架HIPPO系统技术内幕(一)
  • ASP.NET开源框架之HIPPO技术内幕(五)--控件结构
  • 关键时刻还得看咱生信工程师
  • vue+django前后端分离之hippo前端初始化(npm vue-cli)
  • Unity游戏开发笔记(一)2D Hippo’s adventure
  • 分布式高可靠消息中间件-Hippo

selenium基础教程_弹性Selenium基础设施相关推荐

  1. 黑马程序员全套Java教程_Java基础教程_异常(含扩展)(二十三)

    黑马程序员全套Java教程_Java基础教程_异常(含扩展)(二十三) 1.1 异常概述与异常体系结构 1.2 JVM遇到异常时的默认处理方案 1.3 异常处理 1.4 异常处理之try--catch ...

  2. 自动化爬虫selenium基础教程

    一.前期准备 二.基础操作 1.实例化一个浏览器对象 2.对url发起请求 3.标签定位 4.标签交互 5.点击按钮 6.回退.前进和关闭 7.解析数据 8.执行JavaScript程序 9.实现无可 ...

  3. selenium 解析网页_用Selenium进行网页搜刮

    selenium 解析网页 网页抓取系列 (WEB SCRAPING SERIES) 总览 (Overview) Selenium is a portable framework for testin ...

  4. selenium查找文本_在Selenium中查找具有链接文本和部分链接文本的元素

    selenium查找文本 Selenium中CSS定位器是一个基本概念,每个旨在使用Selenium执行自动化测试的测试人员都应该意识到这一点. 在Selenium中充分使用CSS定位器可以帮助您以更 ...

  5. centos7使用基础教程_如何在CentOS 7上使用Metricbeat收集基础结构指标

    centos7使用基础教程 The author selected the Computer History Museum to receive a donation as part of the W ...

  6. sql基础教程和mysql基础教程_书评「SQL基础教程(第2版)」| 你应该知道的基础知识点梳理·上...

    写在前面关于这本书:SQL的基础教程,可以使你在SQL的学习中轻松实现从0到1的过程,循序渐进地掌握SQL的基础知识和技巧.对于零基础来说非常友好,看完能够迅速上手SQL. 关于本文:一篇对这本书的知 ...

  7. selenium火狐驱动_在Selenium Firefox驱动程序上运行测试

    selenium火狐驱动 带有Selenium 3.0的Gecko Marionette Firefox驱动程序 (Gecko Marionette Firefox Driver with Selen ...

  8. selenium无头浏览器_无头Selenium浏览器

    selenium无头浏览器 重要要点 无头浏览器无需用户界面即可运行. 不再支持PhantomJS. JBrowser驱动程序是Java 8的低开销选项. 如果需要Java 11支持,所有当前的Jav ...

  9. 计算机应用基础教程全套教学课件ppt,计算机应用基础教程_全套450页教材教学课件.ppt...

    演示文稿演讲PPT学习教学课件医学文件教学培训课件 <计算机应用基础教程>;;课程内容导航;16. Word文档综合练习(上机)Excel电子表格基本操作(262)Excel电子表格基本操 ...

最新文章

  1. linux 报错 ip_conntrack version 2.4 (8192 buckets, 65536 max) - 304 bytes per conntrack 解决方法
  2. 打开VMware的系统出错
  3. mycat配置访问oracle_教程 | MySql都会了,确定不学习一下MyCat分片?
  4. 学计算机的误解,让人误解的六大专业
  5. ADO.NET数据访问模式
  6. Java定时任务,定时执行某个操作
  7. TopCoder 2019线下比赛
  8. 苹果手机如何查看已经连接过的WIFI密码?
  9. Android仿人人客户端(v5.7.1)——有关滑动式左侧菜单实现过程中网友的疑问解答
  10. Cypress自动化测试:type
  11. 二、java项目常用工具类之beancopy,bean和map转换工具类
  12. MySQL基础语法大全(尚硅谷)
  13. 【前端】【JavaScript】通过成绩判断等级
  14. Web中的HTML、css、jQuery、js
  15. 在 Domino 邮件服务器上配置 Verse On-Premises
  16. Swift 第三方库整理
  17. 山东大学软件学院2022数据库期末考试回忆版
  18. nginx和openresty配置静态资源时,样式错乱
  19. 编译高博ORBSLAM2_with_pointcloud_map,ros下用kinect进行测试。
  20. 2020年中国汽车电子软件行业发展现状、竞争格局及未来发展趋势分析,“软件定义汽车”重构汽车产业格局「图」

热门文章

  1. adoc(asciidoc)文档编辑利器-强于Markdown
  2. 兼容ie(8、9、10、11),google等浏览器的多附件上传完整演示
  3. Springboot实现文件上传文件压缩和前端展示
  4. Echarts+大屏
  5. 快速开发智能硬件,阿里云AIoT首期云端一体训练营开麦了
  6. 如何检索自然语言处理领域相关论文
  7. 自动滚动图片怎么制作HTML,最简单的图片滚动.html
  8. 多媒体系统导论 实验一 基于Photoshop的图像处理
  9. 90后程序猿实习期总结,展望未来
  10. 双向广搜的DIJKSTRA算法--简易的北京地铁导航实现