In this talk I review snippets of test code. The snippets all come from coding dojos performed on http://cyber-dojo.org.
I see the same test anti-patterns time after time after time. Do some of your tests exhibit the same same anti-patterns?
64. make it pass
64
refactor
write a test for
new
functionality
write a test for
new functionality
ship it!
Thursday, 23 October 14
65. make it pass
65
write a test for
new
functionality
write a test for
new functionality
refactor
ship it!
Thursday, 23 October 14
66. make it pass
66
refactor
write a test for
new
functionality
write a test for
new functionality
ship it!
refactor the
diagnostic!
Thursday, 23 October 14
67. make it pass
67
refactor
write a test for
new
functionality
write a test for
new functionality
ship it!
refactor the
diagnostic!
Thursday, 23 October 14
82. You cannot determine
the character or
nature of a system
within itself.
Attempts to do so
lead to confusion
and disorder.
82
Thursday, 23 October 14
95. Summary
Burning calories - a metaphor for understandability
Tests should be simple, linear, low complexity
Tests should be specific
Long_specific_test_names_are_ok
Duplication usually means a missing abstraction
Repetition can indicate a missing abstraction too
Do your diagnostics diagnose?
Custom assertions
Don't cheat on test data - "String1" vs "red"
Beware overusing Mockist style
Code and tests co-evolve
Test at the end is often debugging
Test at the beginning as specification
95
Thursday, 23 October 14