Yesterday an interesting question appeared on Quora in which a user was wondering what forms of automated testing Facebook uses. Steven Grimm, Facebook’s test engineering tech lead, jumped in and provided a pretty comprehensive response. For non-programmers, be warned that his response is completely technical. However given that it was in response to a technical question, it provides superb insight for software developers.
Sten Grim gave the following response when asked about the form of automated testing completed by Facebook:
- For our PHP code, we have a suite of over 1500 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. In fact, we just hired Charley Baker, one of Watir’s lead developers, as a full-time employee. 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.
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.
I personally found the lack of a QA team to be somewhat surprising however not completely odd considering many of the automated systems in place.







![[Inside Social Apps 2012]](http://www.allfacebook.com/wordpress/wp-content/themes/allfacebook2/images/ISA2012_336x100_F_RegisterNow.gif)
![[AllFacebook Stats: Facebook Analytics for Your Business]](http://www.allfacebook.com/wordpress/wp-content/themes/allfacebook2/images/stpro_allfacebookstats.gif)
![[How can Facebook change your business?]](http://www.allfacebook.com/wordpress/wp-content/themes/allfacebook2/images/FMB_A_MAY2011_336x100_F.gif)


I've spent a lot of time developing on the Facebook platform. Their lack of a QA team should not surprise anyone.
Comment by Anon — July 4, 2010 @ 10:25 am
I don't think automatic testing and QA serve the same purpose.
QA's job should be exploratory testing. That you can not automate.
Having developers be responsible for quality, might be why you don't need QA. but It's not the automatic tests that will replace the QA
1500 test's is not much. Actually for a service like Facebook that is nothing.
I assume there these other services add a lot more tests.
Would be nice to see the total number of tests.
(Both Unit as integration tests)
Comment by YvesHanoulle — July 5, 2010 @ 4:23 am
self regulation is always dangerous (see wall street). qa is supposed to provide that counter to development. lacking that external pressure often leads to issues. that being said, the crux of the post was great: unit testing plays an important role in creating sound, robust software, esp in a big environment. I applaud FB for being open about their practices and striving to automate their build cycles.
Comment by chris — July 6, 2010 @ 12:21 pm
@Yves:
It is talked about 1500 test classes (!). That's only for the PHPUnit tests and I assume (I know, I shouldn't…) that one single class contains more then one test.
For the rest, I totally agree with you.
Regards,
Christian
Comment by Christian Baumann — July 12, 2010 @ 8:20 am
I think what’s missing in Facebook’s thinking is service level agreement. They have their eye on very cool, very powerful technologies, but not on how reliable it is. A case in point was with our Facebook App that stores it’s data in the Facebook Data Store. I opened our app a month ago and none of the data was there. We ran some tests and found that the Data Store API had been changed. It took about two weeks to get the issue fixed. (I had to end up calling Facebook to get it resolved.) As soon as Facebook found out about the issue, they fixed it. What they’re not considering is that, we can’t build anything for our users right now that requires their platform to be reliably delivering performance.
Comment by Jim Rubin — July 12, 2010 @ 1:43 pm
the external pressure is coming from the end user.
QA is just a middle man who plays to an end user.
getting rid of the middle man is always good.
Comment by guest — May 25, 2011 @ 12:57 am