Getting started with testing in Lua: learn Busted for unit tests, assertions, setup/teardown hooks, stubs, spies, and running test suites from the command line.
Tutorial series
Lua Testing
6 tutorials — follow in order for the best learning path.
- Getting Started with Testing in Lua
- Using the Busted Test Framework
Learn how the Busted test framework brings BDD-style unit testing to Lua. Covers specs, spies, stubs, mocks, lifecycle hooks, tags, and CI configuration.
- Mocks, Stubs, and Spies in Lua
Mocks stubs spies in Lua: replace functions for unit tests. Covers manual test doubles, Busted stub/spy APIs, package.loaded.
- Measuring Code Coverage in Lua
Learn how measuring code coverage works in Lua with LuaCov and busted. Covers line and branch tracking, CI integration, and enforceable quality thresholds.
- Setting Up CI for Lua with GitHub Actions
Learn setting up CI for Lua projects with GitHub Actions. Run busted across Lua versions, cache dependencies, measure coverage, and enforce quality gates.
- Test-Driven Development Patterns in Lua
Learn test-driven development in Lua using busted. Covers Red-Green-Refactor, Arrange-Act-Assert, fixtures, dependency injection, and triangulation.