Pages

Wednesday 6 June 2007

Wednesday: Unit-Testing and Test-Driven Development

Yeaaaahh ! I scanned my office T-Shirt and I won a version of Office Ultimate 2007! Not the standard, the full one! How cool is that? It costs £480 on Amazon.co.uk... Also attended a session about unit-testing and TDD: DEV347 - Unit Testing and Test Driven Development Wednesday, June 6 10:15 AM - 11:30 AM, N310 A DEV347_randell.pptx Speaker(s): Brian Randell, Doug Seven PICT0055 This kind of completes the talk Ron Jacob gave about Model View Presenter on Monday - the purpose of MVP is to make it possible to automate GUI unit-testing. Doug and Brian's presentation was energetic with colourful slides and very little text. Efficient demos: Doug did the talking, Brian the typing. In a nutshell, this is what they said:
  • Unit-tests are a “living document” that reflects the intended use of the software.
  • Advantage of many small unit-tests: allows you to narrow down the scope of failure upon change.
  • A unit-test cares about its class only.
  • You typically have more lines of UT code than actual code.
  • TDD is ATRIP:
    • Automatic,
    • Thorough,
    • Repeatable (doesn’t depend on dynamic data),
    • Independent (one class only),
    • Professional (well written, commented, easy to maintain).
  • VS2008 Professional will include Unit-Testing (This one triggered a round of aplause).
  • Test-driven development: Red, Green,Refactor.
    • Red: make it fail. Ensure the test fails with a method that's not yet implemented.
    • Green: make it work. Code the minimum to satisfy the test (even if the code is crap).
    • Refactor: make it better. Improve the code, make it easier to maintain.
  • TDD requires discipline (no kidding).
  • Pair programming: one writes the unit-tests, the other writes the implementation.

Brian Randell's blog: http://www.mcwtech.com/CS/blogs/brianr/ Doug Seven: http://dotnetjunkies.com/WebLog/DougSeven/

No comments: