AI Studio treats testing as a first-class part of building. The Test Engineer agent writes
tests, runs them with the run_tests tool, and iterates until they pass — and reads playtest
logs to debug runtime behavior.
run_tests finds and runs spec ModuleScripts in Studio and returns a structured summary:
{ "passed": 7, "failed": 1, "total": 8, "specCount": 3, "results": [ ... ] }- Where it looks: by default, ModuleScripts under
ServerScriptService/Tests, or anywhere named*spec*/*test*. Pass apathto scope it to a specific folder. - Fresh execution: each spec is compiled and run from its current source every time, so
edits are reflected on re-run (unlike
require, which caches). Specs get their ownscriptreference and normal globals, sorequire(script.Parent.ModuleUnderTest)works.
A spec is a ModuleScript that asserts and returns a { passed, failed } count:
-- ServerScriptService/Tests/JumpPad.spec
local pad = workspace:FindFirstChild("JumpPads")
local passed, failed = 0, 0
local function check(name, cond)
if cond then passed += 1 else failed += 1; warn("FAIL: " .. name) end
end
check("JumpPads folder exists", pad ~= nil)
check("has at least one pad", pad and #pad:GetChildren() > 0)
check("pad is anchored", pad and pad:FindFirstChildOfClass("Part") and pad:FindFirstChildOfClass("Part").Anchored)
return { passed = passed, failed = failed }A spec that simply runs without error counts as 1 passed; an error counts as 1 failed with the message captured.
If your project uses TestEZ, write a bootstrap ModuleScript
that runs it and returns the results object — run_tests reads successCount / failureCount
/ errors directly:
-- ServerScriptService/Tests/Bootstrap.spec
local TestEZ = require(game.ReplicatedStorage.TestEZ)
return TestEZ.TestBootstrap:run({ game.ServerScriptService.Tests }, TestEZ.Reporters.TextReporter)Roblox doesn't let plugins press Play, so the loop is:
- AI writes & runs tests (
run_tests) for logic it can exercise in edit mode. - You press Play to exercise runtime behavior (physics, players, replication).
- AI reads logs (
get_logswithfilter: "errors") to see what happened and fix bugs. - Repeat until green.
Just ask, e.g.:
"Write tests for the jump pad and run them. Then I'll playtest — read the logs and fix any errors."
The Coordinator brings in the Test Engineer, which writes specs, runs run_tests, reports the
summary, and — after you playtest — reads the logs and coordinates fixes with the Coder.
For quick checks without persistent spec files, the agents use run_luau, which runs fresh
Luau every time and returns its printed output — handy for one-off assert(...) / print(...)
probes during debugging.