Testix

Contents:

  • Reference
  • Tutorial
    • Design of the LineMonitor
    • End-to-End Test
    • Failing Properly
    • Testix Basics
    • Line Monitor Unit Tests
    • Conclusion
    • More About Readability
Testix
  • Tutorial
  • View page source

Tutorial

This tutorial will walk you through Test Driven Development using Testix and pytest.

We will develop a small project in this tutorial, test driven of course, which solves the following real-life problem: suppose you want to run some subprocess, and you want to read its output line-by-line in real time and take appropriate action.

An example application might be that you want to monitor live logs and do something whenever a log line has ERROR in it.

Let’s call this library LineMonitor.

  • Design of the LineMonitor
    • Unit Tests
    • Integration Tests
    • End-to-End (E2E) Tests
  • End-to-End Test
    • Tests Driving our Code
  • Failing Properly
    • The Importance of Proper Failure
  • Testix Basics
    • Working With Scenarios and Fake Objects
      • Mock Objects
      • The Standard Library Way - unittest.mock
      • Testix Fake Objects and Scenarios
        • Setting the Expectations
        • Meeting the Expectations
    • More Advanced Tests
      • Specifying Return Values
      • Exactness
    • Exact Enforcement
      • Wrong Arguments
      • Unexpected Calls
      • Ways Around Exactness
    • Recap
  • Line Monitor Unit Tests
    • Launching the Subprocess
      • High Level Design
      • Implementation
        • Failing the Test
        • Passing the Test
    • Monitoring The Output
      • Edge Case Test: When There is no Callback
      • Edge Case Test: Asynchronous Callback Registration
      • Let’s Recap
    • Recap
      • YAGNI
      • Code Recap
    • Watching The Subprocess
      • Polling the Read File Descriptor
      • Solving the Blocking Problem
        • Oops, a bug
      • Has the Subprocess Died?
  • Conclusion
  • More About Readability
Previous Next

© Copyright 2022, Yoav Kleinberger.

Built with Sphinx using a theme provided by Read the Docs.