Developers considered harmful
by Lowe Thiderman
harmful.ninjaloot.se
Show of hands
Who here is 100% sure that their code works perfectly?
Really, really awesome
Liars
Fools
Shouldn't we be sure?
Too many people do not test their code
And why is this a problem?
It's because you suck
(...bitch)
- Errors are everywhere
-
SyntaxError, TypeError, NetworkError, CodeError, and semantic errors
Testing is a very effective way to avoid errors!
The excuses
- It takes too much time
-
There is too much untested code already
- Test all new code
- Write tests when you fix things
- We test it manually
- I wrote it; I know that it works
Why I think people don't test
Unit testing
- Really quick
- Small piece of code as possible
class StringFilter(object):
def cummings_filter(self, string):
return string.lower()
class StringFilterTests(unittest.TestType):
def test_cummings_filter(self):
sf = StringFilter()
result = sf.cummings_filter('TeSt StrInG heHE')
self.assertEqual(result, 'test string hehe')
Integration testing
(sometimes functional testing)
- Tests the bigger picture
-
Assume a website : /register/
-
Proper registration
- keNtPhlikkAh_1988
- hunter2
- rebecca_black_r00ls@aol.com
-
Improper registration
Why I think people should test
- You get proof that your code works
- You get confidence in your code
- You will write better code
If only one thing
Reconsider testing