Testing and moving fast: making Selenium work for Facebook presented by Damien Sereni
move fast and break stuff!
tons of users, tons of committers, but luckily # of commits has scaled well with # of committers.
what do we do at facebook since we don't test in prod?
FB: life of a code change
sandbox -> code review -> trunk -> release branch -> 1 billion users
what's unique at FB is that the engineer is responsible throughout the entire process
engineer is responsible for testing; no one else at FB will test your code
once it makes it into trunk, it's destined for release
automated builds cut every week - only end up with 1.5 days to fix your broken code! aaah!
because there are so many frequent releases it's really important that trunk is good
fabricator: submit a code change -> it gets pushed to a bunch of servers and gets tested;
speed > completeness - speed is so important, if we can't run all the tests in 10 minutes, we'll just run the most important ones. 10 minutes is guaranteed to be shorter than a manual code review anyway, so automated test results always get back before the code review is complete
signal > coverage - it's important that people trust the tests; flakey tests are the antithesis. if a test starts failing and it's not fixed in 24 hours, it's deleted! "if the failing test wasn't fixed in 24 hours, it must not have been that important anyway!"
use the same language - barriers to tests are bad! make it easy for your devs to write tests
Problem: too implicit, API didn't help with common tasks, basically just a thin wrapper around API
Solution: PHP Webdriver Bindings 2, recently open sourced
every element written in php get an testid attribute. it does nothing in production, but for tests, that attribute is used directly as the locator.
<a href={URL} testid={UI::TEST_ID}>whee</a>
mobile site and iphone app look exactly the same. their app was a hybrid WebView around the mobile site - great, we can test it in webdriver! but performance was abysmal. what to do?
design features mobile first, then port it to desktop
all the engineers write mobile code, but they're inexperienced at doing mobile. so how do we test them?
release process: exactly the same process as web, but it's elongated. desktop is 1 week cycle, mobile is a 4 week cycle.
mobile master always has to be good because it gets released frequently!
UI testing for native mobile
releasing a new version is complicated - users have to download it themselves, unlike the web.
testing is complicated - there's more than one app (messenger, fb, fb home)
iOS devs write tests in objectiveC+objectiveC bindings, android devs write their tests in java+javabinding.
all the tests go over JSON wire protocol to re-use existing infrastructure
need (to write? to choose?) translator between JSON wire protocol and iOS.instruments/android.UIAutomator
tell us about your secret sauce?: we don't really have one, we've just started working on it
is 4 weeks a good release cycle?: maybe! we're still working on it
testid attribute in html elements?: a feature of XHP (embed html in php?) define attribute in html element, and only put it on the page if it's a webdriver test! who cares if it comes through as an id or as a class or whatever, as long as it's one constant selector then no one has to mess around with it
talk about infra for iOS, android?: it's not too complicated - instead of starting a browser, you're starting an emulator. s'long as you have something that can start the emulator and talk between the emulator and the bindings/JSON wire, then you're sold
php binding space is fragmented why did you make a new one:(?: we wanted one really close to the java bindings, and adam goucher's was the closest but not close enough.
talk about pieceable?: (https://www.pieceable.com/) - do mobile manual testing, but in the browser? they're working on it, they're close.
do you have anything for windows/BB?: nope! ummmm nope
how do you get 10 min feedback test loop?: lots of parallelism; don't run useless tests; get people focused on writing smaller, focused tests. the tests itself need to be fast, long tests are brittle duh
cross browser?: most tests are FF chrome IE, most run without modifications. some tests are only on platforms. just run more things in parallel :)