Test Driven Development

Learn the many virtues of writing tests early and often

Overview

Code that is not tested does not work. It’s a mantra that we all should live by and yet, for various reasons, surprisingly few of us actually do.

But there is so much more to upfront testing than verifying the functional correctness of your code. By paying close attention to the quality of your production and test code you will learn the non-functional benefits of more cohesive, maintainable, readable, modifiable and bug free source code.

So while this course is largely about unit testing and refactoring, it is mostly about design and its purpose is to radically alter how you think about and approach design. We believe that by the end of this course you will not only be more productive, you will also be creating more maintainable and understandable designs.

Outline

Testing Fundamentals

  • Programmer testing vs debugging
  • Cost and quality
  • White-box and Black-box testing
  • Unit Testing
  • Testing behaviour, not methods
  • The xUnit/TestNG family
  • Test cases, suites, runners, and fixtures
  • Assertions/hamcrest
  • IDE tooling

Factoring and Refactoring

  • Intention revealing code
  • Understanding test and production code quality
  • Removing duplication and redundancy
  • Decomposition and delegation
  • Code smells
  • Common refactorings

Testing Single Objects

  • The red, green, refactor rhythm
  • Sufficient design
  • Faking it
  • Obvious implementation

Testability and Isolation

  • Loose coupling and high cohesion
  • Open Closed Principle
  • Strategies, Templates and Decorators
  • Dependency Inversion
  • Dependency Management

Testing Clusters of Objects

  • Decoupling techniques; layering, facades, dependency injection
  • Interaction vs state based testing
  • Pragmatic testing – when and when not to mock
  • Static mocks vs dynamic mocks vs stubs
  • Designing with interfaces
  • Interface discovery through mocking
  • Anti-patterns; statics, globals and singletons

Miscellaneous

  • Understanding test quality – writing ‘Good Unit Tests’
  • Using DSLs to simplify tests
  • TDD vs design by contract
  • The truth about code coverage
  • Continuous integration

Sign up and stay in the loop

Be the first to know about upcoming workshops, courses, talks and events

Learn more

Great course. The instructors were highly knowledgeable as well as clear in their explanations. I'd previously struggled with some of the concepts when explained by others yet I came out of the course feeling like I understood the concepts. The introduction of various developer tools to assist with actually implementing these concepts was highly valuable, demonstrations of technologies such as NUnit, Jasmine, Moq and ReSharper for example. A lot of other courses would simply try to explain the core fundamentals, leaving you with no real idea of how to practically implement those concepts. I'd absolutely recommend this course (and INSTIL in general) to anyone.