S test

From Falkicon/Mechanic · View interactive version

S test is an AI agent skill from the GitHub repository Falkicon/Mechanic. Write and run offline unit tests for WoW addon logic: sandbox.test (restricted Lua runner with the packaged mini framework, Core layer) and addon.test (Busted). Covers spec layout, assertions, filters, mocking WoW APIs and what offline tests cannot prove. Triggers: test, unit test, spec, coverage, B

How to use this skill

Skill file

Testing WoW Addons

Tests prove logic offline; they do not prove in-game behaviour. For that, use the reload protocol in using-mechanic.

Related Commands

MCP Tools

| Task | MCP Tool |

|------|----------|

| Fast offline Core tests | sandbox.test(addon="MyAddon", filter="optional name pattern") |

| Busted tests, full addon environment | addon.test(addon="MyAddon"), addon.test(addon="MyAddon", coverage=true) |

| Run a snippet in the sandbox | sandbox.exec(code="return 1 + 1", addon="MyAddon") |

| Regenerate WoW API stubs | sandbox.generate(namespace="C_Spell") or all (force=true to rebuild); sandbox.status reports them |

All four run Lua on your machine, so they are flagged mutating (code execution). Only run them on code you are working on.

`sandbox.test` layout and behaviour

-- Core/Math_spec.lua
describe("Core math", function()
    it("clamps", function()
        assert.equals(10, Core.Clamp(15, 0, 10))
    end)
end)

`addon.test` (Busted)

Runs the system/desktop/bin busted over *_spec.lua files; with a .busted file in the addon its ROOT is respected, otherwise Tests/, tests/ or spec/ are used. The result reports totals, per-test errors and busted errors. Needs the Lua toolchain (tools.status). coverage=true adds a coverage report.

Routing Logic

| Request type | Load reference |

|--------------|----------------|

| Sandbox, Busted, in-game guides | ../../../docs/integration/testing.md |

| Busted spec patterns | references/busted-patterns.md |

| Mocking WoW APIs | references/wow-mocking.md |

| MechanicLib test registration | ../k-mechanic/references/mechaniclib.md |

Recommended workflow

  1. Sandbox (Core) for fast feedback on pure logic; write a failing regression test first when fixing a bug.
  2. Busted for module interactions and anything needing the full TOC load order.
  3. In game for the final check against live APIs, through MechanicLib-registered tests and addon.output after a confirmed reload.
  4. Keep logic in the Core layer; tests that need many WoW mocks usually mean logic leaked into the view layer.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.