building and scaling a test driven culture

25
Building and Scaling a Test Driven Culture Engineering at Scale / AppNexus Wednesday, May 8 th 2013 @dblockdotorg http://artsy.net 1

Upload: daniel-doubrovkine

Post on 25-May-2015

398 views

Category:

Technology


1 download

DESCRIPTION

Talk given at AppNexus NYC, May 2013.

TRANSCRIPT

Page 1: Building and Scaling a Test Driven Culture

1

Building and Scaling a Test Driven CultureEngineering at Scale / AppNexusWednesday, May 8th 2013

@dblockdotorghttp://artsy.net

Page 2: Building and Scaling a Test Driven Culture

Open Source FTW!

Page 3: Building and Scaling a Test Driven Culture

3

1:0 Dev:Test1124:1 Test:Code

http://www.sqlite.org/testing.html

full automationeverybody tests

rock solid

Page 4: Building and Scaling a Test Driven Culture

4

some automationsome people test

some software doesn’t install

2:1 Dev:Test?:1 Test:Code

Page 5: Building and Scaling a Test Driven Culture

5

full automationcontinuous everything

8 hours of sleep per day5

1:0 Dev:Test2:1 Test:Code

Page 6: Building and Scaling a Test Driven Culture

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

Page 7: Building and Scaling a Test Driven Culture

7

RSpec / BDD

“when X and Y it does X + Y” Data Models : ODM with real data Ruby API : HTTP request – response Integration : Capybara

Page 8: Building and Scaling a Test Driven Culture

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

Page 9: Building and Scaling a Test Driven Culture

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

Page 10: Building and Scaling a Test Driven Culture

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

Page 11: Building and Scaling a Test Driven Culture
Page 12: Building and Scaling a Test Driven Culture

12

10x Everything

Page 13: Building and Scaling a Test Driven Culture

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

Page 14: Building and Scaling a Test Driven Culture

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

Page 15: Building and Scaling a Test Driven Culture

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

Page 16: Building and Scaling a Test Driven Culture

Successful Test Driven Culture

“It Works”

Page 17: Building and Scaling a Test Driven Culture

Signs of a Test Driven Culture

Page 18: Building and Scaling 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 $

Page 19: Building and Scaling a Test Driven Culture

“To Be or Not to Be”

Page 20: Building and Scaling a Test Driven Culture

Testability

Page 21: Building and Scaling a Test Driven Culture

UI?

Page 22: Building and Scaling a Test Driven Culture

Ownership

https://groups.google.com/forum/?fromgroups=#!topic/ruby-grape/VELsU47wXkU

“It doesn’t work!”

Page 23: Building and Scaling a Test Driven Culture

23

Management Money Consultants

Don’t Count On Them

Page 24: Building and Scaling a Test Driven Culture

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

Page 25: Building and Scaling a Test Driven Culture

@[email protected]

http://artsy.net

Thank You