2009/01/07

Code Mash 2009: TDD in .NET

This will start my "blogging on the go" posts with primarily notes from the sessions I'm attending.  This class was pretty useful for digging into TDD if you're at least familiar with unit testing.  The lecture was primarily less than an hour with the vast majority of it being a really large pair programming session.  The instructor was Phillip Japikse.  Really good stuff

* 2 main type of testing: state-based testing; interaction-based testing

* "Software Defect Reduction Top 10 List" IEEE Computer January 2001

* state-based - initialize, provide initial data, interact with it, assert something changed (or did not), must test for both Happy & Unhappy paths

* Interaction-based - verify behavior of SUT, mock the object, ensure behavior acts

* Code Coverage - rough measure of what's tested.  Just another metric.  Roughly 80%

* Dependency Injection is also known as IoC.  Doesn't really cover the differences though.  Basically covers it's for separating instantiation/implementation.

* Constructor Injection; Setter Injection; Interface Injection

* SWAG = Scientific Wild Ass Guess

* Pre-requirements for TDD: Need requirements, ready access to the Product Owner, Source Control System

* no bugs, write opportunities for other developers to fix

* when refactoring, eliminate duplicate code or anything that isn't self-documenting if it's complex.

* writing tests - Name should describe the action of the SUT

* Add the correct Assertions

* Flush out the code to enable the build

* keep list of tests close to workstation - useful to write ideas about other tests on piece of paper (To Do items).  Keeps focus on current work.  Go for easiest ones first.  fresh sheet of paper every day, with not-done items as first items

* possibly leave the last test in a failed state to get you back into the mindset.  Helps jog the memory

* TDD should be applied to any code you actually write.  TED should be for Generated Code (somewhat...)

* FTW: QA team can actually come up with value-adding issues.

No comments: