testing

Testing Groovy code with assert, Spock, and JUnit.

Python: CI/CD for Python with GitHub Actions, Pre-commit, Automated Testing

You pushed a quick fix on Friday, all green on your laptop, and by Monday the app was down because you forgot to run the tests. GitHub Actions exists so that story never happens again. It runs your linting, type checking, and tests automatically on every push and pull request, then deploys only when everything passes. This guide builds a production-ready CI/CD (Continuous Integration and Continuous Deployment) pipeline step by step, plus pre-commit hooks and a Docker deploy job. “If ... Read More

Python Mocking & Patching with unittest.mock

A Python mock is a stand-in object you drop into a test so it never touches the real API (Application Programming Interface), database, or email server. This post walks through the patterns that make unittest.mock click: the @patch decorator, MagicMock, side_effect, return_value, and the one rule about WHERE to patch that trips up almost everyone. “A test that talks to a database is not a unit test.” Michael Feathers, Working Effectively with Legacy Code Last Updated: July 2026 | Tested ... Read More

Python: Unit Testing with pytest, Fixtures, Parametrize

Python pytest from scratch: see how test discovery works, write fixtures for reusable setup, parametrize one test across many inputs, use markers to organize a suite, and measure code coverage with pytest-cov. Every example below was run on real pytest, so the output you see is the output you get. “Code without tests is broken by design.” Jacob Kaplan-Moss You change one line of code, the app still seems to run, and three days later a user reports that something ... Read More