Course: Writing Maintainable Unit Tests

Nothing makes a system more flexible than a suite of tests. Nothing.
— Robert C. Martin (Uncle Bob)

Why attend?

Are unit tests causing you pain? Are they constantly failing whenever you make changes to your production code? Do you spend a lot of time fixing them when they break? Are they difficult to set up and run? Do you have a hard time maintaining or structuring your unit test code? Are they causing you headaches from time to time? Are you ready to give up on writing unit tests or have you already done so?

Or do you just want to step up your game and want to learn more about how to write readable and maintainable unit tests?

This course is for software developers who want to improve upon their existing skills for writing unit tests. By the end of this course, students will have gained the knowledge to build loosely coupled, highly maintainable and robust unit tests that are trustworthy and improve the overall code quality of your software applications. The content of this course is based on 15 years of experience. This knowledge is essential for becoming a senior-level software developer or a technical lead.

Course content

  • Why we need automated tests
  • Taxonomy of tests
  • Solitary versus sociable tests
  • The test pyramid
  • State versus behaviour verification
  • Test-Driven Development (TDD)
  • Clean unit tests
  • The DRY principle
  • The Single-Responsibility Principle (SRP)
  • The DAMP principle
  • Other characteristics of maintainable unit tests
  • Arrange, Act, Assert (AAA)
  • AAA per test method
  • Single assert per test
  • Setup / TearDown
  • AAA per test class
  • Assert last principle
  • Naming unit tests
  • Public interfaces
  • Object mother
  • Test data builder
  • State versus behaviour verification (again)
  • Indirect inputs and outputs
  • SUT builder
  • Auto mocking container
  • Fixture object
  • Making clear observations
  • Failing tests
  • Single assert per test
  • Procedural versus object state verification

Prerequisites

Although the examples that are used throughout this course are written in C#, the principles and guidance discussed here are broadly applicable to other platforms and programming environments as well. So students will be able to universally apply this knowledge throughout the rest of their careers as software developers. Nonetheless, having a good understanding of the following topics will definitely make it easier to pick up the content of this course:

  • A decent understanding of an object-oriented programming language, preferrably C# or Java.
  • Knowledge on how to use Visual Studio or Rider.
  • At the very least some first experiences writing unit tests for production code.
  • Basic or intermediate knowledge of the NUnit and/or xUnit test frameworks.
  • Basic or intermediate knowledge of mocking frameworks like Moq, NSubstitute or Rhino Mocks.

This course takes 2 full days to complete.

Test-Driven Development (TDD) isn’t something that comes naturally. It’s a discipline, like a martial art, and just like in a Kung Fu movie, you need a bad-tempered and unreasonable master to force you to learn the discipline.
— Harry Percival ("Test-Driven Development with Python")

Contact us at infonull@nullprincipal-itnull.be or call +32 496 38 00 82

About

Thank you for visiting my website. I’m a professional software developer since Y2K. A blogger since Y2K+5. Curator of the Awesome Talks list. Past organizer of the European Virtual ALT.NET meetings. Thinking and learning about all kinds of technologies since forever.

Latest articles





Contact information

(+32) 496 38 00 82

infonull@nullprincipal-itnull.be