最近Quora上有个讨论,原意是:“facebook是如何做自动化测试的,他们是怎样测试才能保证每周的升级都可以不出差错的呢?” 参见Link
来自Facebook的Steven Grimm很好地回答了这个问题,觉得还不错,这里以第一人称翻译了一下。
- 对于PHP的代码,我们写了非常多的基于PHPUnit测试框架的测试类,这些测试类覆盖范围比较大,从简单的判读真假的单元测试到大规模的后端服务的集成测试。开发人员把运行这些基于PHPUnit的测试用例作为他们工作中的一部分,同时这些用例也在一些专用的设备上不停地被运行(注:持续集成模式)。当开发人员对一些代码做了比较大的修改时,在开发机器上的自动化工具会运行这些测试用例的同时也会生成相应的代码覆盖率数据,对于需要提交到代码库的diff,在做代码review的时候回自动地产生一份带有覆盖率的测试报告。
- 对于前端的代码,我们使用Waitir(注:Waitir是前端UI的自动化测试框架)做了基于浏览器的界面自动化测试。这些测试用例涵盖了网站页面的功能,特别是针对隐私方面,比如:“用户X发布了Y,而Y应该/不应该被用户Z看到”,有着大量的基于浏览器级别的这种用例。(这些隐私规则当然也会使用一些更低级别的方法被测试到,但是这些规则的实现是必须要严格执行的,并有着非常高的优先级,因此这部分必须要有足够的测试用例来覆盖)
- 除了一些使用watir的全自动化用例以外,我们也有一些半自动化的测试。这些测试也使用了waitir技术,这样可以使一些表格填充或者点击button来完成整改界面上的流程的测试不太单调乏味,而且我们可以很清楚地检查和验证当前的步骤或流程是否正确合理。
- 我们也在尝试开始使用JSSpec (注:JavaScript单元测试框架)去做一些JavaScript代码的单元测试,但当前也是刚刚开始做。
- 对于后端服务的测试,根据不同的服务特性我们采用了许多不同的测试框架与方法。对于一些需要开源发布的项目,我们会使用开源的测试框架,像Boost和JUnit测试框架(注:Boost是针对C++/JUnit是针对Java的测试框架);对于另外一些项目,可能永远都不会发布到外界,我们就是使用内部开发的可以很紧密地与我们build系统集成在一起的C++测试框架。还有少数项目会使用项目级别的测试工具。多数后端服务的测试都会紧紧地和持续集成/Build系统结合在一起,这些持续集成的build系统会不停地针对源代码自动地运行测试用例并生成测试结果,测试结果在存储在数据库的同时会发送到通知系统中去。
- HipHop(注:HipHop for PHP是Facebook的PHP项目)有一套类似的持续集成系统,HipHop的单元测试和所有基于PHPUnit的测试都会被运行。所有的这些测试结果会和基于普通的PHP解释器的结果做对比,从而可以看到不同PHP上的行为的不同;
Facebook的测试工具将测试结果存储在数据库的同时会发送一份通知邮件,这个邮件会包含执行失败的信息并且邮件的接收范围是开发同学可以自己调整的。(例如,你可以选择只有在测试连续失败一段时候的时候才接收到通知邮件,或者当一个用力失败的时候立刻收到通知)。在浏览器UI上,测试结果和 缺陷/开发任务跟踪系统会结合在一起,可以很容易的将测试失败与开发任务关联起来。
测试中一个非常重要的现象是“导致阻塞”,也就是一个测试用例失败有可能会阻止发布(在Facebook,有发布工程师会来评估是否可以将带有问题的代码发布到生产环境,发布工程师在必要的情况下会得到授权去阻止产品的发布)。阻止产品发布上线的事情是被认为是非常严重的问题,因为在Facebook大家对于这种快速发布的模式是深深引以为豪的。
我所在的团队是测试工程部门,主要职责是打造通用基础工具,这些工具会被上述的所有人用到,同时我们也在维护测试框架,像PHPUnit和Watir。Facebook没有专职的测试团队,所有的工程师都需要为他们的代码写自动化测试用例,并维护这些测试用例,保证产品代码改变的同时这些测试代码可以正确地运行。
Facebook的测试还处于一个初期起步尝试阶段,上面的介绍都只是我们在当前运行的方法而已。
公直 2012/2/27
附录原文,
What kind of automated testing does Facebook do? How do they make sure they aren’t breaking things in their weekly pushes?
Steven Grimm, 2005-2012
We do several kinds of testing. Some specifics:
- For our PHP code, we have a suite of a few thousand test classes using the PHPUnit framework. They range in complexity from simple true unit tests to large-scale integration tests that hit our production backend services. The PHPUnit tests are run both by developers as part of their workflow and continuously by an automated test runner on dedicated hardware. Our developer tools automatically use code coverage data to run tests that cover the outstanding edits in a developer sandbox, and a report of test results is automatically included in our code review tool when a patch is submitted for review.
- For browser-based testing of our Web code, we use the Watir framework. We have Watir tests covering a range of the site’s functionality, particularly focused on privacy—there are tons of “user X posts item Y and it should/shouldn’t be visible to user Z” tests at the browser level. (Those privacy rules are, of course, also tested at a lower level, but the privacy implementation being rock-solid is a critical priority and warrants redundant test coverage.)
- In addition to the fully automated Watir tests, we have semi-automated tests that use Watir so humans can avoid the drudgery of filling out form fields and pressing buttons to get through UI flows, but can still examine what’s going on and validate that things look reasonable.
- We’re starting to use JSSpec for unit-testing JavaScript code, though that’s still in its early stages at this point.
- For backend services, we use a variety of test frameworks depending on the specifics of the services. Projects that we release as open source use open-source frameworks like Boost’s test classes or JUnit. Projects that will never be released to the outside world can use those, or can use an internally-developed C++ test framework that integrates tightly with our build system. A few projects use project-specific test harnesses. Most of the backend services are tied into a continuous integration / build system that constantly runs the test suites against the latest source code and reports the results into the results database and the notification system.
- HipHop has a similar continuous-integration system with the added twist that it not only runs its own unit tests, but also runs all the PHPUnit tests. These results are compared with the results from the same PHP code base run under the plain PHP interpreter to detect any differences in behavior.
Our test infrastructure records results in a database and sends out email notifications on failure with developer-tunable sensitivity (e.g., you can choose to not get a notification unless a test fails continuously for some amount of time, or to be notified the instant a single failure happens.) The user interface for our test result browser is integrated with our bug/task tracking system, making it really easy to associate test failures with open tasks.
A significant fraction of tests are “push-blocking”—that is, a test failure is potential grounds for holding up a release (this is at the discretion of the release engineer who is pushing the code in question out to production, but that person is fully empowered to stop the presses if need be.) Blocking a push is taken very seriously since we pride ourselves on our fast release turnaround time.
My team, Test Engineering, is responsible for building the common infrastructure used by all the above stuff, as well as for maintaining PHPUnit and Watir. Facebook has no dedicated QA team; all Facebook engineers are responsible for writing automated tests for their code and keeping the tests maintained as the underlying code changes.
Facebook’s test setup is still very much a work in progress, but the above is at least a taste of what we do in that area.
From http://www.quora.com/What-kind-of-automated-testing-does-Facebook-do
分享到:
相关推荐
Facebook的自动化测试.对于PHP的代码,我们写了非常多的基于PHPUnit测试框架的测试类,这些测试类覆盖范围比较大,从简单的判读真假的单元测试到大规模的后端服务的集成测试。开发人员把运行这些基于PHPUnit的测试...
Facebook怎样做自动化测试最近Quora上有个讨论,原意是:“facebook是如何做自动化测试的,他们是怎样测试才能保证每周的升级都可以不出差错的呢?”来自Facebook的StevenGrimm很好地回答了这个问题,觉得还不错,...
Webgame自动化测试之游戏测试方法.最近两个项目中游荡,首次接触facebook游戏的测试,感触还是很...比较流行的facebook游戏进行自动化测试的还是比较多的,不过由于游戏UI方面的修改比较的多,所以在一开始选取好的测试
1.该自动化框架包含安卓及ios UI自动化测试框架 2.功能包含:判断元素是否存在、点击操作、文本输入、滑动操作、截图功能、长按元素、RGB颜色提取、adb操作功能、断言功能 3.使用yaml文件编写测试用例,实现数据、...
Facebook开源的可访问通用平台,用于理解、管理、部署和自动化自适应实验
facebook-rockin最佳自动化Selenium消除无api工具的机器人机器做成销毁facebook 或者简单地,“ fb.rb”是一种用于对facebook.com进行网页抓取的自动化工具。 特征: 一切都是使用Selenium进行的,没有使用API ...
Magneto是由自动化工程师为自动化工程师构建的,它是出于易于设置,运行和利用的以移动设备为中心的测试自动化框架的需要。 在,我们经历了许多开放源代码解决方案,但没有一个感觉快速,轻松和无忧。 Magneto是用...
如何使用SHAFT_Engine在10分钟内完成跨浏览器测试自动化 :play_button_selector: : 如果希望将SHAFT_Engine与IntelliJ一起使用,请应用以下设置: 运行/调试配置>编辑配置...>模板> TestNG>配置>侦听器>添加所有...
l-曲线矩阵代码测试与测试自动化博客 所有可能的良好测试博客 *需要更新 名字 #个名字 测试部 官方Selenium博客 Google测试博客 希比亚 粘心 Nintex 零转 软件测试时间 MW测试咨询 小夜灯 Excelacom Wakaleo咨询 ...
因此,构建完成后,从第一次提交到最后从詹金斯(Jenkins)到电子邮件通知,一切都是自动化的。 同样,我将Firebase用作后端,并通过Facebook和匿名实现了其注册/登录到应用程序中,并将UID,电子邮件地址,用户名...
自动化历险记 敏捷测试 万物质量 使用Lisa Crispin进行敏捷测试 质量检查历险记 Arborosa 询问测试人员 经验丰富的测试者的水晶球 西西弗斯人的任务 完成约98% B名 二进制剪辑 百度研究 C名称 克里斯·麦克马洪 ...
一套完整的压力测试套件,以及一个自动化性能测试原型; 对MySQL现有测试中发现的问题架构代码做出了一些改动,以避免可能导致的失败或错误; WebScaleSQL的性能改进,包括缓冲池清洗/buffer pool flushing,对...
使用Selenium Webdriver和Java或您喜欢的任何语言为以下场景创建自动化测试: 前往 搜索“男士帽子” 将第一顶帽子放入数量为2的购物车中 打开购物车并确认总的价格和数量是正确的 搜索“女士帽子” 将第一顶...
python 2.7 中文教程及自动化测试介绍 使用Python学习selenium测试工具 性能测试艺术 Java单元测试之模拟利器-使用PowerMock进行Mock测试 网络工具ATC 主页 ...
2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。...
强化学习问题在信息论、博弈论、自动控制等领域有得到讨论,被用于解释有限理性条件下的平衡态、设计推荐系统和机器人交互系统。一些复杂的强化学习算法在一定程度上具备解决复杂问题的通用智能,可以在围棋和电子...
iOS-Tagent是一个基于facebook 的项目,旨在适合 。 我们对其进行了一些自定义的优化和调整,它在以下方面效果很好: 的iOS Xcode ≥13 11.x 10.x-12.x 10倍 ≥9.3 ≥9.3 其他版本的Xcode和iOS未经过全面...
基于强化学习的测试用例选择策略 强化学习(Reinforcement Learning, RL),又称再励学习、评价学习或增强学习,是机器学习的范式和方法论之一。它主要用于描述和解决智能体(agent)在与环境的交互过程中通过学习...
test目录中的文件都是为了travis自动化测试使用的.不用去关注.或者直接使用.这样就可以集成travis自动化测试了. bin目录是在linux环境中使用Nginx+Gunicorn+virtualenv+supervisor来部署的脚本和Nginx配置文件.可以...