Test driven development as the state of the art of todays software developement. These slides provides a short introduction into test driven development (TDD) and gives some arguments why you should use tddTDD or why not
2. Who is ?
Hackerstolz is a young club from the Rhine-Neckar region. We organize
Hackathons, promote the digital culture and advocate for more women in the IT
field .
3. Agenda
- What is test-driven-development (TDD)?
- Basic concept of TDD
- Pro’s and con’s of TDD
- Need of test frameworks and unit tests
- What is a test framework?
- What is a unit test?
- Conclusion
- Live coding: Create StringUtil
4. What is test-driven-development (TDD)
- Original idea from NASA in Mercury project in 1960
- Mercury project was first try of NASA to send a real human to universe.
5. What is test-driven-development (TDD)
- Original idea from NASA in Mercury project in 1960
- Mercury project was first try of NASA to send a real human to universe.
- After a while this idea found its way back to development and was
mentioned in the book “Guide to better Smalltalk” from Kent Beck
6. What is test-driven-development (TDD)
- Original idea from NASA in Mercury project in 1960
- Mercury project was first try of NASA to send a real human to universe.
- After a while this idea found its way back to development and was
mentioned in the book “Guide to better Smalltalk” from Kent Beck
Xtreme Programming
SUnit - Smalltalk
JUnit - Java
7. Basic concept of TDD
- Test first!
- Write your test code first
- Afterwards write your code unter test
8. Basic concept of TDD
- Test first!
- Write your test code first
- Afterwards write your code unter test
- Red phase
- First test code has to fail
9. Basic concept of TDD
- Test first!
- Write your test code first
- Afterwards write your code unter test
- Red phase
- First test code has to fail
- Yellow/Blue phase
- Code under test was writen, test execution runs?
10. Basic concept of TDD
- Test first!
- Write your test code first
- Afterwards write your code unter test
- Red phase
- First test code has to fail
- Yellow/Blue phase
- Code under test was writen, test execution runs?
- Green phase
- Test execution works succeesfully and code under test is implemented
12. Pro’s of TDD
- Less code redundancy
- No hidden features
13. Pro’s of TDD
- Less code redundancy
- No hidden features
- Clear API which can be tested
14. Pro’s of TDD
- Less code redundancy
- No hidden features
- Clear API which can be tested
- Code “security” and developer confidence raises
15. Pro’s of TDD
- Less code redundancy
- No hidden features
- Clear API which can be tested
- Code “security” and developer confidence raises
- Stability of main development branch/trunk
16. Pro’s of TDD
- Less code redundancy
- No hidden features
- Clear API which can be tested
- Code “security” and developer confidence raises
- Stability of main development branch/trunk
- Customer confidence
18. Con’s of TDD
- Costly development in time and resources
- Writing test code can be very complex
19. Con’s of TDD
- Costly development in time and resources
- Writing test code can be very complex
- IDE integration is very helpful
20. Con’s of TDD
- Costly development in time and resources
- Writing test code can be very complex
- IDE integration is very helpful
- More code to write
- Each line has positive and negative test code
21. Con’s of TDD
- Costly development in time and resources
- Writing test code can be very complex
- IDE integration is very helpful
- More code to write
- Each line has positive and negative test code
- Test framework API’s must be used
22. Need of test frameworks and unit tests
- You need a test framework to run automated test
23. Need of test frameworks and unit tests
- You need a test framework to run automated test
- Unit tests form the test suite
24. Need of test frameworks and unit tests
- You need a test framework to run automated test
- Unit tests form the test suite
- Developer has to adapt test framework usage
25. Need of test frameworks and unit tests
- You need a test framework to run automated test
- Unit tests form the test suite
- Developer has to adapt test framework usage
- Devide tests into unit, integration, scenario tests
- Test coverage tools needed
26. What is a test framework?
A test automation framework is an integrated system that sets the rules of
automation of a specific product. This system integrates the function libraries, test
data sources, object details and various reusable modules. These components act
as small building blocks which need to be assembled to represent a business
process. The framework provides the basis of test automation and simplifies the
automation effort
https://en.wikipedia.org/wiki/Test_automation#Framework_approach_in_automation
27. What is a test framework?
A test automation framework is an integrated system that sets the rules of
automation of a specific product. This system integrates the function libraries,
test data sources, object details and various reusable modules. These
components act as small building blocks which need to be assembled to represent
a business process. The framework provides the basis of test automation and
simplifies the automation effort
https://en.wikipedia.org/wiki/Test_automation#Framework_approach_in_automation
28. What is a unit test?
- Automated test to run code under test
29. What is a unit test?
- Automated test to run code under test
- Testing smallest unit of code in an application
30. What is a unit test?
- Automated test to run code under test
- Testing smallest unit of code in an application
- Code under test should have as little as possible dependencies to other
“units”
31. What is a unit test?
- Automated test to run code under test
- Testing smallest unit of code in an application
- Code under test should have as little as possible dependencies to other
“units”
- Each unit test should be independent
from others
32. What is a unit test?
- Automated test to run code under test
- Testing smallest unit of code in an application
- Code under test should have as little as possible dependencies to other
“units”
- Each unit test should be independent
from others
- Using mocks, stubs, spies
33. What is a unit test?
- Automated test to run code under test
- Testing smallest unit of code in an application
- Code under test should have as little as possible dependencies to other
“units”
- Each unit test should be independent
from others
- Using mocks, stubs, spies
- Can be used for documenation
34. What is a unit test?
- Automated test to run code under test
- Testing smallest unit of code in an application
- Code under test should have as little as possible dependencies to other
“units”
- Each unit test should be independent
from others
- Using mocks, stubs, spies
- Can be used for documenation
- Prove of concept for architecture
design and API
35. What is a unit test?
- Automated test to run code under test
- Testing smallest unit of code in an application
- Code under test should have as little as possible dependencies to other
“units”
- Each unit test should be independent
from others
- Using mocks, stubs, spies
- Can be used for documenation
- Prove of concept for architecture
design and API
37. Conclusion
- Unit testing is important. It helps to…
- reduce the costs of failure
- prove architecture and API
38. Conclusion
- Unit testing is important. It helps to…
- reduce the costs of failure
- prove architecture and API
- makes the usage of software clear
39. Conclusion
- Unit testing is important. It helps to…
- reduce the costs of failure
- prove architecture and API
- makes the usage of software clear
- But is also…
- difficult to write good tests
40. Conclusion
- Unit testing is important. It helps to…
- reduce the costs of failure
- prove architecture and API
- makes the usage of software clear
- But is also…
- difficult to write good tests
- a problem with higher test code complexity
41. Conclusion
- Unit testing is important. It helps to…
- reduce the costs of failure
- prove architecture and API
- makes the usage of software clear
- But is also…
- difficult to write good tests
- a problem with higher test code complexity
- consumption of time
42. Live coding
- String utility class in node.js
- Requirements:
- Build a single StringUtil class which should
- Chomp string left and right with given template strings
- LowerCase / UpperCase
- Provide fluent API