These are slides used in a workshop on TDD. Slides explain more about different types of pair programming techniques when to use each, what is TDD and how to start thinking about TDD as mindset change.
1. Agenda
• Goals of the session
• Benefits
• Preparation
• Do’s
• Introduction to TDD
• Kata
• Don’t do’s
• Learning resources
• Questions and Answers
2. Goals
• Learning to collaborate
• Practice a technique for paired programming
• Introduction to TDD
• Retrospect on don’t do’s of paired
programming
4. What would you need?
• Technique
• Machine setup
• Lots of patience and willingness to collaborate
5. Do’s
• Let the partner express idea fully
• Be willing to try parter’s idea
• Provide feedback during the participation
• Code when its your turn
• Show persistence and patience
6. TDD - Test Driven Development
What Is TDD?
• Test-driven development (TDD) is a software development process
that relies on the repetition of a very short development cycle.
• TDD process defines codebase tests that drive what code you write
7. TDD - Test Driven Development
How to TDD?
Add test: before any code is written, an automated test is created that takes into account all
the possible inputs, outputs and error conditions.
Run test: the test is run for the first time. The test will fail because this is simply because no
code yet exists to satisfy the test.
Write code: the code is written, or improved to overcome any identified failings. This process
can be repeated until the test is passed.
Re-factor: once the test is passed, the code can be cleaned, or ‘re-factored’. As long as the
code continues to pass the test, the code works. This allows the code to be improved while
eliminating concerns that any changes might introduce bugs.
Repeat: the whole process is repeated.
9. Why TDD?
• Confident about meeting acceptance criteria
• Writing the tests first requires you to really consider what do you want from the code.
• TDD creates code that is maintainable, flexible, and easily extensible and there are
fewer Bugs
• The development time to market is shorter.
• You are able to identify the errors and problems quickly.
• TDD tells you whether your last change (or refactoring) broke previously working
code.
• TDD creates a detailed specification of the code
10. Unit Test and JUnit Framework
A unit test is a piece of code written by a developer that executes a specific
functionality in the code to be tested and asserts a certain behavior or state.
A unit test targets a small unit of code, e.g., a method or a class.
• assertTrue
• AssertThat
• AssertEquals
11. Pairing & TDD in action
Watch Pairing and TDD in action
- Check if a number is an even number
- Session number nVCAwh
12. Pair and TDD
FizzBuzz Coding Exercise:
1) If a number is a multiple of 3 write Fizz
2) If a number is a multiple of 5 write Buzz
3) If a number is a nultiple of 3 and 5 write FizzBuzz
• To Do:
1. With your pair partner talk about the test
scenarios
2. Write your first test
3. Pair partner writes code implementation
13. Lets practice
• Go to your browser
• http://cyber-dojo.org
• Click on Join a session
• Session id = mFAYuS
•
14. Retrospective
1. What did you learn from your partner?
2. What did you learn about yourself that you
can improve upon next time?
15. Don’ts
• Express your superiority
• Never back down
• Watch silently
• Code silently
• Betray trust
• Dominate keyboard
• Win
16. Resources
• Plural sight course -
• Paired programming workshops by Bob Allen -
Connect with us
• Collaboration between team -
https://it2.spt.ford.com/sites/SDM/FAF/Pages/R
oles/ProductManagerOverview.aspx
• Blog by Bob Allen -
https://thehubat.ford.com/thread/14523
Editor's Notes
1. Talk about collaboration between non developer folks on the team and developers.
2. Talk about importance of learning using practice. So practice one technique – ping - pong
3. TDD - think about test first and think about smallest thing you can do to make the test pass
4. Don’t dos - identify the things that you did which you could improve upon during next paired programming experience
5. Learning resources
6. See us after the session or during next sessions