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
6
7. RSpec / BDD
“when X and Y it does X + Y”
Data Models : ODM with real data
Ruby API : HTTP request – response
Integration : Capybara
7
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)
end
end
8
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)
end
end
9
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}]”
end
end
10
13. JavaScript: 960 Tests
Jasmine
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
14. 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
15. 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
18. 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 $
24. Remove Those that Talk About Testing
Hire From Open-Source
Remove the Safety Net
Use a Non-Compiling Language
Do Devops
24
Maintain a Test Driven Culture