building and scaling a test driven culture
DESCRIPTION
Talk given at AppNexus NYC, May 2013.TRANSCRIPT
1
Building and Scaling a Test Driven CultureEngineering at Scale / AppNexusWednesday, May 8th 2013
@dblockdotorghttp://artsy.net
Open Source FTW!
3
1:0 Dev:Test1124:1 Test:Code
http://www.sqlite.org/testing.html
full automationeverybody tests
rock solid
4
some automationsome people test
some software doesn’t install
2:1 Dev:Test?:1 Test:Code
5
full automationcontinuous everything
8 hours of sleep per day5
1:0 Dev:Test2:1 Test:Code
6
Artsy.net Website is [Relatively] Big
5534 Automated Tests
1h22m to Run / 6 Machines
http://art.sy/artwork/liu-di-animal-regulation-no-2
7
RSpec / BDD
“when X and Y it does X + Y” Data Models : ODM with real data Ruby API : HTTP request – response Integration : Capybara
8
Models = Mongo ODM + Fabricators: 2156 tests
context “spline” do let(:spline) { Fabricate :spline } it “reticulate! updates reticulated count” do expect { spline.reticulate! }.to change(Spline.reticulated, :count).by(1) endend
9
Ruby API: 1894 Tests
context “spline” do it “create” do expect { post “/api/spline?name=test” response.status.should == 201 }.to change(Spline, :count).by(1) endend
10
Integration: 1484 Tests
context “spline” do let(:spline) { Fabricate :spline } it “displays a spline” do visit “/spline/#{spline.id}” page.should have_css “.spline[id=#{spline.id}]” endend
12
10x Everything
JavaScript: 960 TestsJasmine
beforeEach ->
view = new App.Views.UsersEdit view.model = new App.Models.User fabricate ‘user’
describe ‘#save’, -> it ‘saves the model’, -> view.model.set ‘name’, ‘updated’ view.save() JSON.parse(jqLastAjaxRequest.data).name.should equal ‘updated’
13
JavaScript: Recent Projects
Node – headless unit testing for client-side code Mocha – rspec-like testing Sinon – stub JSDom – simulate DOM API Zombie – headless browser integration testing
Test Driven Culture
Tests are second nature A bug becomes a test becomes a fix A feature starts as a test becomes a feature Tests absorb developer stress Everyone has confidence in moving forward
Successful Test Driven Culture
“It Works”
Signs of a Test Driven Culture
Cost of Failure
A very important demo with a potential investor A very important person using our site Hundreds of thousands of users You’re selling things for $
“To Be or Not to Be”
Testability
UI?
Ownership
https://groups.google.com/forum/?fromgroups=#!topic/ruby-grape/VELsU47wXkU
“It doesn’t work!”
23
Management Money Consultants
Don’t Count On Them
24
Remove Those that Talk About Testing Hire From Open-Source Remove the Safety Net
Use a Non-Compiling Language Do Devops
Maintain a Test Driven Culture