Agile latvia evening_unit_testing_in_practice
-
Upload
denis-udod -
Category
Technology
-
view
561 -
download
0
description
Transcript of Agile latvia evening_unit_testing_in_practice
- 1. Unit testing in practice Part I
2. Let's start 3. Unit test
- What kind of monster is this?
4. Unit testing- What kind of monster is this ?
- Programmers write code. The code is always unique.
- The code is designed to solve problems.
- The purpose of the code is to do it well.
5.
- Programmers write code. The code is always unique.
- The code is designed to solve problems.
- The purpose of the code is to do it well.
Unit testing- What kind of monster is this ? 6.
- Programmers write code. The code is always unique.
- The code is designed to solve problems
- The purpose of the code is to do it well.
Unit testing- What kind of monster is this ? 7.
- Programmers write code. The code is always unique.
- The code is designed to solve problems
- The purpose of the code is to do it well.
Unit testing- What kind of monster is this ? 8. Unit testing- What kind of monster is this ? 9. Unit testing- What kind of monster is this ? 10.
- NEW DETAIL -> TEST BENCH -> TESTING -> PILOT -> ...
Unit testing- What kind of monster is this ? 11.
- CODE REAL LIFE ...
Unit testing- What kind of monster is this ? 12.
- CODE REAL LIFE ...
Why is this happening? Unit testing- What kind of monster is this ? 13.
- CODE REAL LIFE ...
Why does this happen?
- We missed TEST BENCH :
-
- FUNCTIONALITY TESTS
-
- DEFECT SEARCH
-
- QUALITY CONTROL
-
- REPAIRABILITY CONTROL
-
- ...
Unit testing- What kind of monster is this ? 14.
- Testing code with code.
UNIT TESTING Unit testing- What kind of monster is this ? 15.
- For more details, see:
- or
Unit testing -What kind of monster? 16. Unit testing -What's the point?
- Writingtests
17. Unit testing -What's the point?
- Writingsimpletests
18. Unit testing -What's the point?
- Writing simple testsfor each method of class
19. Unit testing -What's the point?
- Write code and protect.
20. Unit testing -What's the point?
- Write code and protect...
- If the code is broken, we will know.
21. Unit testing -What's the point?
- We are not afraid
- We are not afraid to change the code
- We are not afraid that you will break any other code
- We are not afraid thatothersbroke any your code
22. Unit testing -What's the point?
- We are not afraid
- We are not afraid to change the code
- We are not afraid that you will break any other code
- We are not afraid thatothersbreak any of your code
23. Unit testing -What's the point?
- We are not afraid
- We are not afraid to change the code
- We are not afraid that you will break any other code
- We are not afraid thatothersbreak any of your code
24. Unit testing -What's the point?
- We are not afraid
- We are not afraid to change the code
- We are not afraid that you will break any other code
- We are not afraid thatothersbreak any of your code
25. Unit testing - Who needs it?
- Maybe programmers don't?
- Maybe programmers do?
26. Unit testing - Who needs it?
- Maybe not need programmers?
- May need programmers?
27. Unit testing -what is the purpose?
- Looking for bugs ?
- YES !
- All programs have bugs.
Edsger W. Dijkstra 28. Unit testing -what is the purpose?
- Looking for bugs ?
- YES !
- All programs have bugs.
- or NO ?
- Our code has bugs.
29. Unit testing -what is the purpose?
- Looking for bugs ?
- YES !
- All programs have bugs.
- or NO ?
- Our code has bugs.Butnot only bugs....
30. Unit testing -what is the purpose?
- Yes, our code hasbugs ...butnot only bugs.
- Our code has also:
- the huge cost of change
31. Unit testing -what is the purpose?
- Yes, our code hasbugs ...butnot only bugs.
- Our code has also:
- the huge cost of change
- smelly code
32. Unit testing -what is the purpose?
- Yes, our code hasbugs ...butnot only bugs.
- Our code has also:
- the huge cost of change
- smelly code
- nightmarish design
33. Unit testing -what is the purpose?
- Yes, our code hasbugs ...butnot only bugs.
- Our code has also:
- the huge cost of change
- smelly code
- nightmarish design
- fear to touch
34. Unit testing -what is the purpose?
- Yes, our code hasbugs ...butnot only bugs.
- Our code has also:
- the huge cost of change
- smelly code
- nightmarish design
- fear to touch
- horror
- .....
35. We all have heard that unit tests:
-
- reduce bugs in new features
-
- reduce bugs in existing features
-
- reduce the cost of change
-
- improve design
-
- allow refactoring
-
- force you to "slow down and think"
-
- make development fun and faster
-
- reduce the fear
36. So what is the problem? 37. So what is the problem?
- We dont have time to write tests.
- We have to code new features instead.
38. Why is this happening?
-
- Your code is broken,
- but you do not know it.
-
- Someone broke your code,
- and you do not know it.
-
- You have broken someone's code,
- and nobody knows.
39. Why is this happening?
- There are many "reasons" not to use the unit - testing.
40. And all because
- I dont have time to learn how to do it well.
- I dont have time to learn how to do it.
- I don't have time to learn.
- I don't have time.
- I want to writeREAL CODE NOW!
41. Developers think...
- - I do not make mistakes in code
- + Please, visithttp://www.rpnc.lv
- - I have complicated code
- + Make it simple.
- - Writing unit tests is unnecessary complexity
- + Make code simple
42. Management thinks...
- - We have testers to find bugs
- - Unit tests are a waste of time (expensive)
43. Management thinks...
- - We have testers to find bugs
- - Unit tests are a waste of time (expensive)
44. Unit Tests and You
- What should I do?
- Pick a testing framework (xUnit)
- Start writing unit tests
- Learn how do do this
- Catch yours and colleagues bugs
45. About me
- Denis Udod
- past: more 20 years IT experience
- now: lead trainer in
- how to find: [email_address]