#Testing

19 posts

Terraform Operations #3 Code Quality and Testing: tflint, pre-commit, and terraform test
5 min read

Terraform Operations #3 Code Quality and Testing: tflint, pre-commit, and terraform test

On top of fmt and validate, tflint catches provider-knowledge errors — instance types that do not exist, for example — before plan ever runs, and pre-commit hooks automate all of it at commit time. We learn Terraform's built-in test framework, terraform test, through a module-testing example covering tftest files and the run and assert structure, then close with a practical rule for choosing between plan tests and apply tests based on their cost difference.

Rust in Practice #6 Testing: From Parser Unit Tests to CLI Integration Tests
4 min read

Rust in Practice #6 Testing: From Parser Unit Tests to CLI Integration Tests

Wrapping loglens in a safety net. #[cfg(test)] unit tests living next to the code (the parser's normal, boundary, and failure cases), integration tests in the tests/ directory, CLI tests that run the built binary and verify output and exit codes with assert_cmd and predicates, temporary log files via tempfile, and what it means that cargo test runs tests in parallel.

Wails in Practice #8 A Testing Strategy — Verifying the Service and Repository
5 min read

Wails in Practice #8 A Testing Strategy — Verifying the Service and Repository

Actually write the tests promised back in #1 when we split the layers. Covers unit tests that verify service logic in pure Go without Wails, integration tests that verify the repository with a temporary SQLite, sweeping edge cases with table-driven tests, and wiring these into #6's CI so they run automatically before a release.

Python Testing #7: Running Tests in CI — People Forget, Machines Don't
5 min read

Python Testing #7: Running Tests in CI — People Forget, Machines Don't

Build a CI workflow that runs pytest automatically with GitHub Actions. Covers uv caching, a Python version matrix, coverage comments on PRs, pre-commit, and separating slow tests to wrap up the series.

Python Testing #6: Test Design — Good Tests and How to Read Coverage
6 min read

Python Testing #6: Test Design — Good Tests and How to Read Coverage

Test design fundamentals from the AAA pattern and behavior-driven tests to test double terminology, dealing with flaky tests, and reading pytest-cov coverage numbers the right way.

Python Testing #5: Testing the Outside World — Files, HTTP, Databases, and Web Frameworks
6 min read

Python Testing #5: Testing the Outside World — Files, HTTP, Databases, and Web Frameworks

A test that mocks everything guarantees nothing about real behavior. A strategy for testing the outside world: write real files with tmp_path, block only the network boundary with respx, and reset databases with transaction rollbacks.

Python Testing #4 mock and monkeypatch: Controlling What You Can't Control
7 min read

Python Testing #4 mock and monkeypatch: Controlling What You Can't Control

How to pin down dependencies that change on every run — time, randomness, external APIs — with monkeypatch and unittest.mock, including the patch-path trap and where over-mocking begins.

Python Testing #3 parametrize and Markers: Multiply Cases, Run Selectively
5 min read

Python Testing #3 parametrize and Markers: Multiply Cases, Run Selectively

How to collapse input-only test variations into one case table with @pytest.mark.parametrize, and run only the tests you want using skip, skipif, xfail, custom markers, and the -m and -k options.

Python Testing #2 Fixtures: Injecting Setup and Teardown
6 min read

Python Testing #2 Fixtures: Injecting Setup and Teardown

How to inject test setup code with @pytest.fixture — yield teardown, scope trade-offs, sharing via conftest.py, and built-in fixtures like tmp_path.

Python Testing #1 Getting Started with pytest: Why One assert Is All You Need
7 min read

Python Testing #1 Getting Started with pytest: Why One assert Is All You Need

How to install pytest and write your first test with a single assert — plus how it differs from unittest, how to read failure output, and the test discovery rules.

Testing #6 E2E with Playwright and CI Integration — Closing the Track
12 min read

Testing #6 E2E with Playwright and CI Integration — Closing the Track

The track's finale. E2E verifies real user flows in a real browser. Playwright setup, where locators fit, the page object pattern in brief, GitHub Actions CI integration, coverage reports, and a recap of all six posts.

Testing #5 — User Events and Form Tests: Where userEvent Belongs
8 min read

Testing #5 — User Events and Form Tests: Where userEvent Belongs

All about user input and form submission. The difference between userEvent and fireEvent, the patterns of type/clear/click/keyboard/upload, form tests on top of React Hook Form, validation error scenarios, and what a form test should really verify.