Test Driven Development: Writing Clean Code
Imagine shipping software with no bugs! Imagine adding new features at any time without breaking existing code. Imagine no more long, late night debugging sessions. It turns out there are teams delivering on these dreams. Test Driven Development (TDD), a key practice of Agile methods, is critical to their success.
Agile methods insist on a high quality code base at all times. Clean tested code lowers the cost of iterative feature development. A comprehensive suite of continuously running unit and acceptance tests provides scaffolding for safe, frequent changes and feature addition. Testing as you go eliminates costly, unpredictable test and fix cycles.
As a developer or tester participating in this seminar you'll learn the rhythm of test-code-improve-integrate. You'll see how unit tests support easy, safe design improvement, or refactoring. You'll gain skill by practicing TDD techniques in hands-on exercises throughout the course. You'll integrate your working code into a code base and see how continuous integration software runs regression tests on the entire code base providing immediate feedback on your check-in. You'll see how that suite of tests helps you quickly identify and correct bugs that creep in.
Test Driven Development is a skill that takes time and practice to learn and perfect. In this two-day seminar you'll learn from experienced coaches with many years experience using tests to drive effective designs and coding practices. You'll receive individual time from the instructors, allowing you to leave with a strong foundational understanding as well as the tools needed for further improvement. At this course you will:
- Explore techniques for getting the most out of xUnit frameworks such as JUnit
- See and feel the Agile test-code-refactor-integrate rhythm
- Build Test Driven Development into a project using continuous integration tools
- Use acceptance tests to drive feature development
- Become confident refactoring (improving the design of) your tested code
Intended Audience
This seminar is ideal for developers, testers, architects and other IT professionals who are interested in creating clean, well crafted code.
Outline
- Overview of Test Driven Development (TDD)
- TDD and other Agile Practices
- Using xUnit for Unit Testing
- TDD rhythm: test-code-refactor-integrate
- Continuous integration
- Acceptance testing
- Acceptance testing rhythm: acceptance test-TDD-iterate
- Mock objects
- Refactoring
Instructors
As a Senior Software Engineer, Zhon Johansen is responsible for building software products for customers. For the past 8 years, all of Zhon's code has been written using TDD. In addition to delivering well tested code, he has studied, practiced, taught, and influenced companies to adopt Extreme Programming since early 1999.
He helped coach "XP for a Day" at the first XP/Agile Universe. He presented "Extreme Fishbowl" at several conferences including XP/Agile Universe 2002. He presented "Making money with (or without) software" at Agile 2004, "Stop Interacting with the Customer!" at Agile 2005. In 2006, he presented "Agile before they know it" and "Humans: Designed for Interaction" at Agile 2007. He is an active participant (and often facilitator) at the Salt Lake Agile Round Table. Zhon co-founded XP Utah in December of 2001 and has run it continuously since then.
Participants will learn
- basics of xUnit testing frameworks
- acceptance test frameworks such as FIT
how to integrate and automatically run test over an entire code base using tools like CruiseControl
- refactoring to easily and safely improve design
- communicating effectively using tests
- developing high quality designs using small incremental changes
- a new way to think about designing software
What You will Cover
Who Should Attend
Developers, Testers, Architects, anyone who builds software product.
Random Thoughts
- Machine Setup Time
- Outline
- FIT Tests
- Design
- Success Stories
- Build the right thing vs. Build the thing right
- xUnit (where to find the xUnits)
How do you handle bugs? (http://www.flickr.com/photos/dratz/1045336659/)
- How does TDD fit into the big picture? (Process Miniature)
- TDD make writing code easier
- Increase the speed of your tests
clean code allowing for simple emergent design changeable, modifiable
Why do I want to teach this class (My Objective)?
- I want other people doing effective TDD
Are these the right people? What do they want from me?
- Developers, I would like to see automated testers.
Topics to cover
- xUnit
- FIT
- Selenium
continuous integration & test execution - the update test, checkin cycle
- advanced unit testing ideas - stubs and mocks
- Feather's testing legacy code stuff? - what's there?
- Testing patterns - Rainsberger, Meszaros?
- TDD is test driven /design/ not test driven /development/
- CRC cards for simple design?
- pairing (learn by doing)
Things to do
- CD for participants with xUnit frameworks, FIT, svn client
SVN server on one of our machines with CruiseControl.rb installed
- Ambient Orb installed
- some simple - but not too simple body of code to add to
- user stories that add to that code
- develop a 2 day agenda
- develop a 1 day extension with more advanced topics
Schedule 1
- 1/2 day on XUnit...
- 1/2 day with test-first "rhythm"...
by example & practice...
- 1/2 day on AT's (framework(s) to be decided)
- 1/2 day distinguishing between "building the thing right" (UT's) and "building the right thing" (AT's)The latter including things like:
- Handling "bug fixes"
- Elucidating requirements with AT's
Getting QA & Dev working together
- etc.
- 1/2 day on refactoring :-D
Schedule 2
- 1/2 day TTD in Agile Development (Process Miniature)
