On Sep 15/16/17 I had the great opportunity to attend a Test-Driven Development (TDD) Masterclass together with Robert C. Martin (Uncle Bob) of Object Mentor.
The event was arranged by Zilverline, a young Amsterdam-based company specialising in Agile consultancy and training. The folks of Zilverline did a great job: training location was superb as they were the facilities and their support though out the event.
I think it hardly gets more interesting that digging into the deep secrets of TDD, especially with one of its greatest preachers. The 3 days were just enough to go through the approach of TDD, when/how to do it, obstacles and enemies during the implementation and what you really want to achieve.
The audience was pretty advanced, everybody bringing real hands-on experience mostly with TDD or at least with development and testing enterprise software. Great chance to discuss/compare/challenge different ways of working with experienced developers/techies… which is (based on my experience at least) very rare in most trainings.
- Why TDD: started off with benefits of TDD (no debugger!, coding for maintenance/evolution, good tests are good specifications) and with what “gets into the way” (scepticism in the team, management perception it is costly and/or affect deadline…).
- Clean Tests: showing bad tests and how to refactor them to be more readable and have a better structure.
- Stubbing vs Mocking: differences of the two approaches and understand when one is preferable over the other.
- Exercise: running code coverage (Emma) and discuss where improvements can be beneficial. Increase code coverage and re-run.
- TDD Ping Pong: 2 developers, one writes the test, the other makes it pass and performs the required refactoring. Devs then switch role. All class takes part. Interesting and funny :-), a good interactive exercise. Read more here.
- F.I.R.S.T. – Fast Isolated Repetable Self-verifyng Timely, the principles behind good testing. Really interesting the discussion around “Isolated”, how business logic should be isolated by DB or the web container (of course :-P)
- Test Conventions: naming tests, package structure, “Test Class per Class” approach
- Maintaining/Preserving Tests: avoiding fragile tests (coupling is dangerous), test data sensitivity, dependency on the context (date/time, hw), when tests are discarded
- Dem0 Fitnesse: quick demo of the Fitnesse AcceptanceTesting Framework of course 😉
- Exercise: add new tests and fix existing ones in the Fitnesse demo project
- Coverage and Metrics: code coverage, CRAP (yes.. it is not an acronym..)
- GUI Testing: decoupling GUI testing from business logic testing, few words on Selenium
- Levels of Testing (unit-component-integration-system-exploratory)
- Legacy Code (Boy Scout Rule applies)
- Exercise: extend demo project with a new functionality (adding unit and acceptance tests)
Bob Da Man!
Uncle Bob is a great character full of charm and humour. Each session always starts with a “free-ride” in the world of physics where he would analyse the speed of light or indulge on the entropy around us… then he happily jumps in the TDD business
Uncle Bob is the creator of Fitnesse, an Acceptance Testing Framework where tests are written in a wiki (supposedly in a business-friendly way).
To management: “If the code doesn’t need to work then pick any deadline you fancy”
“Legacy code is code without unit testing“… this is probably out of the “Working with legacy code” book
“Ward Cunningham is the type of guy who throws ideas in the air and let the others do something with it”