Slide 1

Slide 1 text

Testing is overrated Luke Francl

Slide 2

Slide 2 text

Test::Unit RSpec Shoulda TDD BDD unit tests behaviors test-first test-along Selenium story runner Watir rcov green bar coverage test cases fixtures mock stub Mocha object mother autotest fuzz random miniunit

Slide 3

Slide 3 text

All you need is tests

Slide 4

Slide 4 text

Extensive research

Slide 5

Slide 5 text

testing is hard

Slide 6

Slide 6 text

total_withholdings = 0 employees.each do |employee| if employee.government_retirement_withheld < MAX_GOVT_RETIREMENT government_retirement = compute_government_retirement(employee) end company_retirement = 0 if employee.wants_retirement && eligible_for_retirement(employee) company_retirement = get_retirement(employee) end gross_pay = compute_gross_pay(employee) personal_retirement = 0 if eligible_for_personal_retirement(employee) personal_retirement = personal_retirement_contribution(employee, company_retirement, gross_pay) end withholding = compute_withholding(employee) net_pay = gross_pay - withholding - company_retirement - government_retirement - personal_retirement pay_employee(employee, net_pay) total_withholdings = total_withholdings + withholding total_government_retirement = total_government_retirement + government_retirement total_retirement = total_retirement + company_retirement end save_pay_records(total_withholdings, total_government_retirement, total_retirement) 1 6 17

Slide 7

Slide 7 text

code coverage Code Coverage

Slide 8

Slide 8 text

def test_last_day_items_are_privacy_scoped_for_non_friends non_friend = create_user story = stories(:learning_no) story.published_at = 10.minutes.ago story.save! story = stories(:aaron_private_story) story.published_at = 5.minutes.ago story.save! items_for_non_friend = accounts(:quentin_and_aaron).last_day_items assert_privacy_status(items_for_non_friend, "Public") end You can’t test code that’s not there

Slide 9

Slide 9 text

Tests have bugs

Slide 10

Slide 10 text

def test_critical_functionality begin ... Bunch of stuff to exercise code ... # Commented out by Luke to fix test failure # assert "Some important assert", condition rescue # Don't let anything fail this test! end end

Slide 11

Slide 11 text

Developer testing isn’t very good at finding defects

Slide 12

Slide 12 text

Unit testing 50% 25% 75% Code reviews Code inspections Prototyping System test 100% 0% Defect Detection Rates of Selected Techniques

Slide 13

Slide 13 text

Unit tests Code reviews User testing Manual testing * Set overlap completely fabricated

Slide 14

Slide 14 text

Complements to developer testing

Slide 15

Slide 15 text

Manual testing

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

code review kitty is not pleased with your code

Slide 18

Slide 18 text

Growing better developers

Slide 19

Slide 19 text

Usability testing

Slide 20

Slide 20 text

The ultimate

Slide 21

Slide 21 text

From Don’t Make Me Think by Steve Krug

Slide 22

Slide 22 text

Don’t put all your eggs in one basket...

Slide 23

Slide 23 text

...or you’ll end up as roadkill

Slide 24

Slide 24 text

Thanks! (You can yell at me over drinks.)

Slide 25

Slide 25 text

Jan Tik audreyjm529 aussiegall jpctalbot Flowizm Stuck in Customs GAV01 Andrew Dowsett hans.gerwitz