luaguides

Tutorial series

Lua Testing

6 tutorials — follow in order for the best learning path.

  1. Getting Started with Testing in Lua

    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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.