
Explore the different types of tests and how automated tests improve code quality, maintainability, cycle time, and delivery speed.
Explore the taxonomy of tests—unit, integration, api, database, acceptance, ui, performance, regression, and feature tests—and learn to identify applicable types for your use cases.
Differentiate solitary tests as fast unit tests that verify a single class in isolation, and sociable tests as slower integration tests that validate interactions across modules using configuration files.
Understand the test pyramid and why most tests should be solitary unit tests, with a small number of integration and system tests to avoid cascading failures.
Explore state verification and behavior verification in unit tests with concrete examples like a resume manager and a register user handler, contrasting the Detroit and London schools of TDD.
Learn the basics of test-driven development, red green refactor, and inside-out versus outside-in approaches, with small unit tests and sociable tests that verify wiring and interactions.
Compare solitary and sociable tests, apply the test pyramid for a healthy mix, and focus on unit testing, validating state and behavior through inside-out and outside-in TDD.
Explore the characteristics and principles that make your unit tests maintainable, including DRY practices and the Single Responsibility Principle.
Apply the five rules of the first acronym introduced by Robert Martin—fast, independent, repeatable, self-validating, timely—to unit tests, ensuring fast feedback, isolation, environment flexibility, binary results, and timely test adoption.
embrace the dry principle, don't repeat yourself, ensuring every piece of knowledge has a single authoritative representation, and apply the arrange act assert pattern with focused, self-contained unit tests.
Embrace the single responsibility principle, ensuring a class has one reason to change; the lecture refactors unit tests for burglar alarm system using a factory class and composition over inheritance.
Apply the damp principle to unit tests by keeping tests descriptive, self-contained, and readable, balancing damp and dry for maintainable, verifiable test code.
Explore additional guidelines for maintainable unit tests, including fixed arrange-act-assert patterns, keeping tests between 1 and 20 lines, avoiding branches, and maintaining psychometric complexity of one, to reduce maintenance.
Explore the characteristics of maintainable unit tests, apply dry and single responsibility principles to unit test code, and improve test reliability and readability.
Learn foundational approaches to clearly composing maintainable unit tests, focusing on readability and a predictable structure so tests are easy to read and dissect.
Master the arrange, act, assert pattern for unit tests, three stages that set up inputs and state, execute an operation, and verify outcomes.
Apply the arrange act assert pattern in a single test method, grouping three lines or fewer without blank lines, and separate stages with blank lines or comments to improve readability.
Apply the single assert per test principle to keep unit tests dry, readable, and easier to locate failures by validating a single behavior.
Avoid moving duplicate arrange and act code into a setup method, as it can violate the single responsibility principle. Keep tests self-contained and address duplication without overreliance on setup/teardown.
Examine how arrange-act-assert patterns and test fixtures improve unit test readability and maintainability, using single context per class, one-time setup, and explicit scenarios for dry but damp code.
Adopt the single assertion principle by placing the assertion as the last line in each test method. Avoid interlinked assertions to simplify failure diagnosis and support the arranged act pattern.
Examine two naming styles for unit tests and fixtures, including arrange act assert and bdd given when then, to describe behavior clearly.
Master the essential anatomy of a unit test—arrange, act, and assert—following principles that keep tests readable and maintainable, including the arrange-act-assert approach, the assert last principle, and two naming styles.
Explore patterns and techniques to keep unit tests decoupled from production code while ensuring coverage, and avoid brittleness by decoupling tests from dependencies and the environment.
Advocate testing through public interfaces only, ensuring every line of code is exercised by public methods and avoiding direct tests of private methods.
Explore the object model pattern and factory methods to simplify unit test setup, enabling readable scenarios like expense sheets and approvals with less coupling.
Learn how the test data builder pattern decouples unit tests from implementation, enabling a flexible domain-specific language for test data via with methods and built instances, improving readability and maintainability.
Compare state verification and behavior verification in unit tests, exploring black box and white box testing, coupling, and the use of fake objects and mocks to balance reliability and flexibility.
Explain indirect inputs and outputs alongside direct inputs and outputs for methods, and show how queries and commands embody the command query separation principle in unit tests.
Explore test doubles such as dummy, step, spy, mock, and fake, and learn how dependency injection and careful usage reduce coupling, improve testability, and guide maintainable unit tests.
Decouple unit tests from subject constructors with the subject under test builder, using test tables to manage dependencies and prevent cascading failures.
Explore auto mocking containers that combine IoC and mocking frameworks to automatically supply the subject under test with test doubles. Return the same testable instance to simplify test setup.
Leverage the fixture object pattern to decouple the subject under test from collaborators, configure indirect inputs, and use a mini DSL with test data builders.
Decouple unit tests from production code using object mother, data builder, and test builder patterns, with an auto mocking container and fixture objects, and learn two test doubles.
Explore patterns and techniques for writing clear assertions and observations to communicate the intent of our unit tests, alongside readable test code, and prioritize high-quality diagnostic information when tests fail.
Learn to write clear unit-test assertions by choosing readable syntax, honoring the expected-actual argument order, and using constraint or fluent libraries for better failure messages.
Ensure unit tests fail for the right reason by using single or default, so the search statement runs when a column cannot be found and diagnostics stay clear during tdd.
Shows why a single assert per unit test avoids assertion roulette and demonstrates testing a map method from an expense sheet to a view model, with diagnostics and maintainable assertions.
Compare procedural and object state verification to select the appropriate testing approach, and use the deep equal library for object comparisons to keep code clean and tests maintainable.
Master patterns for writing clear assertions and observations, ensure only assertions fail tests with a single assertion per test, and contrast procedural versus object state verification to guide when to apply each approach.
Master maintainable unit tests by embracing test driven development, deliberate practice, and quick feedback cycles. Keep tests readable and loosely coupled as a key side effect of solid production quality.
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 on the brink of giving up on writing unit tests altogether 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 experienced software developers who want to improve upon their existing skills in 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 with Test-Driven Development. This knowledge is essential for becoming a senior-level software developer or a technical lead.
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 (Java, Python, JavaScript, ... etc.). So students will be able to universally apply this knowledge throughout the rest of their careers as software developers.