Course Code: unitcshapthls
Duration: 21 hours
Prerequisites:

Prior experience with Unit testing 

Overview:

-

Course Outline:

Comprehensive Unit & Integration Testing Curriculum


 Module 1: The Goal of Unit Testing

  • Understanding the purpose and value of unit tests
  • Using coverage metrics to measure test suite quality
  • Characteristics of a successful test suite

 Module 2: What Is a Unit Test?

  • Defining a "unit test"
  • Testing one class in isolation
  • Approaching unit tests for large graphs of interconnected classes

 Module 3: The Anatomy of a Unit Test

  • Structuring a clear and maintainable unit test
  • Exploring the xUnit testing framework
  • Reusing test fixtures across tests
  • Effective naming conventions for unit tests
  • Refactoring tests into parameterized formats
  • Using assertion libraries to enhance readability

 Guidelines for Effective Unit Testing


 Module 4: The Four Pillars of a Good Unit Test

  • Protection against regressions
  • Resistance to refactoring
  • Avoiding false positives
  • Abstraction from implementation details
  • Key concepts in test automation

 Module 5: Mocks and Test Fragility

  • Differentiating between mocks and stubs
  • Observable behavior vs. implementation details
  • Understanding how mocks contribute to test fragility

 Module 6: Styles of Unit Testing

  • Output-based testing
  • State-based testing
  • Communication-based testing
  • Unit testing in functional architecture contexts

 Module 7: Refactoring Toward Valuable Unit Tests

  • Identifying code suitable for refactoring
  • Analyzing and improving unit test coverage
  • Managing conditional logic in controllers

Integration Testing Essentials


 Module 8: Why Integration Testing Matters

  • What defines an integration test
  • Deciding which out-of-process dependencies to test
  • Abstracting dependencies using interfaces
  • Integration testing best practices

 Module 9: Mocking Best Practices

  • Getting the most value from mocks
  • Verifying interactions at the system boundaries
  • Using spies as alternatives to mocks

 

 Module 10: Testing the Database

  • Setting prerequisites for reliable DB testing
  • Managing database transactions in tests
  • Lifecycle of test data
  • Answering common questions about DB testing

Unit Testing Anti-Patterns


 Module 11: Recognizing and Avoiding Anti-Patterns

  • Testing private methods
  • Exposing private state
  • Leaking domain knowledge into tests
  • Code pollution and over-engineered tests
  • Mocking concrete classes
  • Testing with time-sensitive logic