Chapter 21: Further Reading

Annotated Bibliography

1. Python Testing with pytest by Brian Okken (Pragmatic Bookshelf, 2nd Edition, 2022)

The definitive guide to pytest. Okken covers fixtures, parametrization, markers, plugins, and advanced configuration in depth. This is the single best resource for mastering pytest, and it serves as an excellent companion to this chapter. Start here if you want to go deeper on any pytest topic.

2. pytest Documentation — Official (https://docs.pytest.org/)

The official pytest documentation is thorough and well-organized. The sections on fixtures, parametrize, and the plugin index are particularly valuable. Keep this bookmarked as a reference while writing tests.

3. Hypothesis Documentation — Official (https://hypothesis.readthedocs.io/)

The Hypothesis library documentation includes an excellent tutorial, a detailed description of every strategy, and a guide to writing custom strategies. The "What you can generate and how" section is essential reading for anyone using property-based testing.

4. Architecture Patterns with Python by Harry Percival and Bob Gregory (O'Reilly, 2020)

While primarily about software architecture, this book includes outstanding coverage of testing patterns for Python applications, including the repository pattern, unit of work, and how to structure tests for complex systems. The testing chapters demonstrate integration and E2E testing with real-world patterns.

5. Test-Driven Development with Python by Harry Percival (O'Reilly, 3rd Edition, 2024)

Percival walks through building a complete web application using TDD. While it predates the AI-assisted workflow described in this chapter, the TDD discipline it teaches is directly applicable. Learn TDD from this book, then apply the TDD-AI workflow from this chapter.

6. "Property-Based Testing with Hypothesis, and Associated Case Studies" — Hypothesis Blog (https://hypothesis.works/articles/)

The Hypothesis project blog contains detailed case studies of property-based testing finding real bugs in real software. These articles provide practical inspiration for designing your own property-based tests and understanding what properties to look for.

7. Working Effectively with Legacy Code by Michael Feathers (Prentice Hall, 2004)

Feathers' classic book on adding tests to untested code is highly relevant to AI-assisted development. When you inherit AI-generated code that lacks tests, the techniques in this book — characterization tests, seam-based testing, and dependency breaking — are invaluable.

8. The Art of Unit Testing by Roy Osherove (Manning, 3rd Edition, 2024)

A comprehensive guide to writing maintainable, readable, and trustworthy unit tests. Osherove covers test naming, test structure, mock objects, and test anti-patterns. The chapter on avoiding fragile tests is particularly relevant when testing AI-generated code.

9. "Mutation Testing: Overview and History" by Jia and Harman (IEEE, 2011)

This academic survey provides a thorough introduction to mutation testing concepts, operators, and tools. While academic in tone, it gives a deep understanding of why mutation testing catches bugs that coverage-based metrics miss. Accessible online through IEEE or academic repositories.

10. pytest-mock Documentation (https://pytest-mock.readthedocs.io/)

The pytest-mock plugin provides a fixture-based interface to unittest.mock that integrates cleanly with pytest. The documentation is concise and includes practical examples of mocking with the mocker fixture.

11. Continuous Delivery by Jez Humble and David Farley (Addison-Wesley, 2010)

The foundational text on continuous integration and deployment pipelines. Chapter 4 on the "Commit Stage" is particularly relevant to this chapter's discussion of CI testing workflows. The principles in this book underpin modern CI/CD practices.

12. "Coverage.py Documentation" (https://coverage.readthedocs.io/)

The official documentation for the coverage.py tool, which pytest-cov wraps. Includes detailed configuration options, branch coverage explanation, and strategies for excluding code from coverage analysis. Essential for understanding and configuring coverage reporting.

13. "Beyond Unit Tests: Property-Based Testing in Python" — PyCon Talk by Zac Hatfield-Dodds (Various Years)

Zac Hatfield-Dodds, the Hypothesis maintainer, has given several excellent conference talks on property-based testing. These talks demonstrate Hypothesis with live coding examples and provide intuition for identifying testable properties. Available on YouTube.

14. Clean Code by Robert C. Martin (Prentice Hall, 2008)

Chapter 9, "Unit Tests," lays out the principles of clean test code. Martin's F.I.R.S.T. principles (Fast, Independent, Repeatable, Self-Validating, Timely) remain the gold standard for test quality, and they apply directly to tests for AI-generated code.

15. mutmut Documentation (https://mutmut.readthedocs.io/)

The Python mutation testing tool referenced in this chapter. The documentation includes installation instructions, usage examples, and guidance on interpreting mutation testing results. A practical starting point for incorporating mutation testing into your workflow.