Lesson 10 of 11
Testing at scale: cloud CI, bots and soak tests
Close the biggest gap in most Roblox CI pipelines: execute real Roblox tests in CI via Open Cloud Luau Execution, maintain a migration fixture corpus, simulate two-server locks and bots, and write the rules a nightly soak gate would apply.
By the end you can
- Run automated Luau tests against a built staging place from GitHub Actions using Open Cloud Luau Execution
- Build a frozen migration fixture corpus and contract tests that prove every historical save shape upgrades cleanly and idempotently
- Test two-server session handoffs, DataStore failure injection and multi-client storms with StudioTestService and synthetic bots
- Write a soak gate's rules (warm-up exclusion, memory growth, p95 frame time) as a pure function, plus a disciplined flaky-test quarantine policy
Before this: Continuous integration: every check, blocking, Deploying with Open Cloud: staging and production, Unit tests with Jest-Lua, Integration playtests, Performance: MicroProfiler, memory, network
1What Beacon Yard's CI skips today
Open .github/workflows/ci.yml at m14-ship. The build job builds both default.project.json and test.project.json, then uploads beacon-yard.rbxlx. Notice what never runs: beacon-yard-tests.rbxlx is built and immediately discarded.
- name: rojo build
run: |
mkdir -p build
rojo build default.project.json -o build/beacon-yard.rbxlx
- name: rojo build the unit-test place
run: rojo build test.project.json -o build/beacon-yard-tests.rbxlx
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: beacon-yard-rbxlx
path: build/beacon-yard.rbxlx
Static checks catch syntax errors, bad types and lint issues in seconds. They cannot catch a broken DataMigration formula, a ReceiptRules edge case, or a runtime error when ServerScriptService modules require each other inside Roblox.
| In the picture | In Roblox |
|---|---|
| The wind tunnel | Open Cloud Luau Execution running checks against the exact built place |
| The crash-test dummy | Simulated players and bot storms testing joins, leaves and lock handoffs |
| The strain gauge | Soak-test heap slope and p95 tick-time gates that block regressions |
Think of an aircraft before its first flight. It goes through a wind tunnel, a crash-test sled carries dummies through every impact the team can think of, and strain gauges record how the frame bends over hours of stress. None of that is the flight, but each test catches a failure before a passenger would. Here the wind tunnel is Luau Execution running the built place, the dummies are bots and simulated players, and the strain gauges are the soak test's memory and frame-time numbers.
Think of it as A wind tunnel and crash-test sled run before every flight
In Beacon Yard's .github/workflows/ci.yml at m14-ship, what happens to build/beacon-yard-tests.rbxlx after rojo build creates it?
Answer
Nothing; CI builds the test place to prove Rojo succeeds, but never executes the Jest specs inside Roblox. At m14-ship, CI checks formatting, lint, types and Rojo assembly, but no automated job executes the Luau test suite on Roblox yet.
Open this step in lesson mode · Link to this step · This confused me
2Running Roblox tests in CI with Luau Execution
In Deploying with Open Cloud: staging and production, you ran a four-check tasks/smoke.luau script against a published staging version using Open Cloud Luau Execution (universe.place.luau-execution-session:write)1. At m15-scale, the luau-execution job targets a dedicated CI test experience on pushes and same-repository pull requests when the test credentials are configured.
Two critical details make cloud CI safe and reliable:
- Protect your Open Cloud secret on pull requests. Never expose
TEST_ROBLOX_API_KEY, an Open Cloud key for a test experience only, to untrusted fork pull requests (pull_request_targetwith checkout is a classic secret leak)2. Static and Lune checks run without the cloud credentials. The tagged cloud job only runs on pushes and same-repository pull requests. - Parse the log strictly. A Luau Execution task ends in state
COMPLETEwhenever the script finishes without throwing, even if it printedTEST FAILor zero tests ran. The tagged runner requiresCOMPLETE, a configured completion marker and no configured failure marker. Jest usesUNIT SUITE DONEandUNIT SUITE FAILED. Smoke usesSMOKE DONEandSMOKE FAILED. The challenge later in this lesson uses a stricter rule with its ownTEST SUITE DONEmarker and a positive pass count.
Be clear about which job actually gates a merge at m15-scale. The first tier is the specs job: it runs every Jest spec in Lune, with a small Jest shim, on every push, along with the boot check and the smoke script. The cloud job is the second tier. The tag's own tasks/run-specs.luau says it is not verified yet whether Jest-Lua can load modules inside a Luau Execution task, so treat the cloud result as advisory until it has passed once.
specs:
name: unit specs (lune)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: CompeyDev/setup-rokit@1d9390883f7ebce19d48f5b8d006e11d387c92ab # v0.2.1
with:
version: v1.2.0
- name: lune run scripts/lune/specs
run: lune run scripts/lune/specs
- name: lune run scripts/lune/check-challenge-modules
run: lune run scripts/lune/check-challenge-modules
- name: lune run scripts/lune/check-boot
run: lune run scripts/lune/check-boot
- name: lune run scripts/lune/smoke
run: lune run scripts/lune/smoke
Also check your Jest package choice: Beacon Yard currently pins jsdotlua/jest@3.10.0 (MIT, last release December 2024)3. Roblox's own Roblox/jest-roblox repo (MIT, active) now publishes directly to Wally as roblox/jest@3.21.0 and roblox/jest-globals@3.21.04. Keep in mind that Jest.runCLI relies on debug.loadmodule (documented for Edit mode in unit/run.server.luau) and Luau Execution does not start normal game scripts or physics. The tagged tasks/run-specs.luau calls Jest.runCLI on the test place's specs. tasks/smoke.luau checks module contracts directly. Keep RunGameTests for Studio Play sessions.
A Luau Execution task finishes with state COMPLETE and logs: ["Booting", "TEST PASS migration_v1"]. It crashes silently before printing TEST SUITE DONE. What must your CI gate return?
Answer
Fail, because the TEST SUITE DONE sentinel is missing so the run was truncated. Require all three conditions together: TEST SUITE DONE present, zero TEST FAIL lines, and at least one TEST PASS line.
Open this step in lesson mode · Link to this step · This confused me
3A migration fixture corpus and data contracts
Look at unit/specs/DataMigration.spec.luau at m14-ship: five unit tests cover DataMigration.apply for BeaconYard_v1. That is a strong start, yet once a game ships ten updates over two years, engineers forget what version 2 or version 4 profiles actually looked like on disk.
function DataMigration.apply(data: ProfileData, raw: unknown): boolean
if data.legacyImported then
return false
end
data.legacyImported = true
local legacy = DataMigration.readLegacy(raw)
if legacy == nil then
return false
end
data.coins += legacy.coins
data.speedOwned = data.speedOwned or legacy.speedOwned
return true
Studios solve this with a migration corpusMigration corpusA frozen collection of real historical save shapes used to verify every data migration runs safely and idempotently.Think of it as a museum of every old bank form the vault still has to honour.: a folder of immutable fixture records, one for every schema version ever written to production plus known corrupt shapes (empty nil, NaN coins, negative numbers, string booleans, missing arrays, extra fields from a rolled-back future version)5. Never edit an old fixture once it has shipped; only add new ones.
Every CI run checks two contracts on every fixture:
- No silent loss: expected coins and unlocked items survive the upgrade intact.
- Idempotence: running
migrate(migrate(raw))produces the exact same output asmigrate(raw), so a retry after a network blip never grants a bonus twice.
type Profile = { version: number, coins: number, speedOwned: boolean }
local function migrate(raw: unknown): Profile
if typeof(raw) ~= "table" then
return { version = 3, coins = 0, speedOwned = false }
end
local t = raw :: { [string]: unknown }
local coins = 0
if typeof(t.coins) == "number" and t.coins == t.coins and t.coins >= 0 and t.coins < math.huge then
coins = math.floor(t.coins)
end
return { version = 3, coins = coins, speedOwned = t.speedOwned == true }
end
local fixtures = {
{ name = "v0_nil", raw = nil, wantCoins = 0 },
{ name = "v1_legacy", raw = { coins = 120.7, speedOwned = true }, wantCoins = 120 },
{ name = "v2_partial", raw = { version = 2, coins = 45 }, wantCoins = 45 },
{ name = "v3_corrupt", raw = { coins = 0 / 0, speedOwned = "yes" }, wantCoins = 0 },
}
local passed, failed = 0, 0
for _, f in fixtures do
local first = migrate(f.raw)
local second = migrate(first)
local ok = first.coins == f.wantCoins
and second.coins == first.coins
and second.speedOwned == first.speedOwned
and second.version == first.version
if ok then passed += 1 else failed += 1 end
print(string.format("%s: %s coins=%d", f.name, if ok then "ok" else "FAIL", first.coins))
end
print(string.format("corpus: %d passed, %d failed", passed, failed))
v0_nil: ok coins=0
v1_legacy: ok coins=120
v2_partial: ok coins=45
v3_corrupt: ok coins=0
corpus: 4 passed, 0 failedA v4 migration gives returning v3 players a one-time 50-coin thank-you bonus, but forgets to record a flag or bump the version field. Which corpus check catches the bug immediately?
Answer
The idempotence check: running migrate(migrate(v3_fixture)) produces 50 extra coins on the second call. Testing migrate(migrate(raw)) == migrate(raw) across every historical fixture catches double-grant bugs before a single player loads the update.
Open this step in lesson mode · Link to this step · This confused me
4Two-server session tests and failure injection
Beacon Yard's DataService.luau uses ProfileStore's StartSessionAsync and listens to session.OnSessionEnd so a player whose lock moves to another server is kicked instead of spending coins twice. How do you test that without launching two live Roblox servers and timing a teleport by hand?
Build a pure-Luau two-server lock simulator and inject failures on purpose:
- Server A acquires the lease on
Player_42. Server B attempts to acquire while the lease is active and must wait or fail. - Server A releases the lock cleanly (or crashes until the lease expires). Server B acquires it.
- Server A attempts a stale write after losing the lock: the guard must reject it so coins cannot be duplicated across servers.
- Inject a DataStore throttle error (
502/ request budget exhausted) during a receipt grant or save: verifyProcessReceiptreturnsNotProcessedYetand never drops or double-grants the purchase.
type Entry = { owner: string?, expiresAt: number, coins: number }
local store: { [string]: Entry } = {}
local function acquire(key: string, srv: string, now: number, lease: number): boolean
local e = store[key]
if e == nil then
store[key] = { owner = srv, expiresAt = now + lease, coins = 0 }
return true
end
if e.owner == nil or e.owner == srv or e.expiresAt <= now then
e.owner = srv
e.expiresAt = now + lease
return true
end
return false
end
local function writeCoins(key: string, srv: string, now: number, delta: number): boolean
local e = store[key]
if e == nil or e.owner ~= srv or now >= e.expiresAt then
return false
end
e.coins += delta
return true
end
local a1 = acquire("Player_42", "srvA", 100, 60)
local b1 = acquire("Player_42", "srvB", 110, 60)
print(string.format("A lock=%s B lock=%s", tostring(a1), tostring(b1)))
local wA = writeCoins("Player_42", "srvA", 120, 50)
print(string.format("A write=%s coins=%d", tostring(wA), store["Player_42"].coins))
store["Player_42"].owner = nil -- Server A releases session on teleport
local b2 = acquire("Player_42", "srvB", 125, 60)
print("handoff B lock=" .. tostring(b2))
local staleA = writeCoins("Player_42", "srvA", 126, 500)
print(string.format("stale A write=%s coins=%d", tostring(staleA), store["Player_42"].coins))
A lock=true B lock=false
A write=true coins=50
handoff B lock=true
stale A write=false coins=50In the Run cell above, suppose Server B's lease was 60 seconds starting at t=125 (so expiresAt = 185). Server B hangs and misses its heartbeat. At t=190, Server C calls acquire("Player_42", "srvC", 190, 60), then Server B wakes up at t=191 and calls writeCoins("Player_42", "srvB", 191, 25). What happens?
local c = acquire("Player_42", "srvC", 190, 60)
local b = writeCoins("Player_42", "srvB", 191, 25)
print(c, b, store["Player_42"].coins)
Answer
true, false, and 50. Lease expiry lets a new server recover from a crashed server without letting the frozen old server corrupt the balance if it wakes back up.
Open this step in lesson mode · Link to this step · This confused me
5Multiplayer bots, StudioTestService and where automation stops
Unit tests and mocks verify rules in milliseconds, yet some bugs only appear with multiple live clients: a player leaving mid-round while holding the beacon prompt, or eight players triggering coin pads simultaneously.
Roblox's StudioTestService lets a Studio plugin drive real automated sessions6:
StudioTestService:ExecutePlayModeAsync(args)starts a solo Play test and returns whatever the server passes toStudioTestService:EndTest(result).StudioTestService:ExecuteMultiplayerTestAsync(numPlayers, args)launches one server and 1 to 8 simulated client DataModels, withStudioTestService:LeaveTest()on a client to test disconnect and cleanup paths automatically.
For higher concurrency (like 50 simulated players), complement StudioTestService with a server-side bot harness that feeds synthetic join, move, swing and leave events into your services directly.
Both sidesRemember: Automated cloud CI, bots and soak tests is a wind tunnel and crash-test sled run before every flight.
The eight clients are the crash-test sled: few, but real, with real replication and real disconnects. The bot harness is a rack of dummies: many more of them, but each one only does what its script says.
Where does it break?“A wind tunnel and crash-test sled run before every flight” is a good picture of automated cloud ci, bots and soak tests. Where does it stop being true?
It breaks here. A crash dummy never gets bored, never misreads a confusing shop label, and never invents a creative social exploit that real players will find in ten minutes.
The true model. Automated cloud tests, bots and soak runs prove that builds load, data survives migrations and servers hold steady under load, freeing human playtesters to judge fun, clarity and edge-case behaviour.
A crash dummy proves the frame holds under fifty simulated joins and that no table leaks on leave. It cannot tell you whether the shop prices feel stingy, whether a newcomer notices the beacon beam, or whether two players will invent a hilarious way to block a doorway. Automated testing protects reliability so human playtesters can focus on fun.
Your 50-bot soak test and 8-client StudioTestService storm both pass with zero errors and flat memory. Which problem can STILL ship to players?
Answer
New players overlook the beacon prompt and quit in the first two minutes because the yard's visual cues are unclear. Bots catch leaks, crashes and concurrency bugs. Human playtests catch clarity, pacing and fun.
Open this step in lesson mode · Link to this step · This confused me
6Soak tests, performance gates and flaky quarantine
A server in a hit game can stay live for 12 hours or longer. A tiny 8 KB leak per player leave is invisible in a two-minute playtest, yet it grows the server's memory by tens of megabytes a day and never comes back down.
A soak testSoak testA long-running automated test that repeats joins, leaves and game loops to catch memory leaks and frame-time drift.Think of it as running a new engine on a test stand for hours to see if the oil pressure slowly drops. runs an accelerated storm (say 200 simulated join/leave cycles and 20 short rounds, or a nightly 30-minute staging run) and records { heapKb, tickMs } samples after every cycle7. Two rules keep the gate trustworthy:
- Skip warm-up samples. The first few cycles allocate caches, pools and lazy module state. Measure memory growth from the post-warm-up baseline to the final sample (for example, fail above 5% growth).
- Gate on p95 tick time, not average. Averages hide periodic spikes caused by garbage collection or unbatched pathfinding; gating on the 95th percentile (
p95Ms) catches regressions early.
When a test flakes in CI (passes 9 runs, fails 1), never train the team to click Re-run blindly. Move the flaky spec into an explicit quarantine list with an owner and a linked issue, keep running it non-blocking so you still collect failure traces, and fix or delete it within a week.
Why does evaluateSoak skip the first warmupCount samples before measuring heap growth percentage?
Answer
Initial rounds populate one-time caches and lazy tables; skipping warm-up measures steady-state leaks instead of startup allocation. Excluding warm-up isolates steady-state memory drift from legitimate one-time startup allocations.
Open this step in lesson mode · Link to this step · This confused me
7Choosing your test runners and frameworks
Where and how studios run Roblox tests
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| Open Cloud Luau Execution | Runs a Luau task against a published place version on Roblox's cloud servers. | PR and staging CI smoke/contract suites on GitHub Actions. | Does not start game scripts or physics; needs a dedicated CI place and API key. |
| StudioTestService | Built-in Studio plugin API driving solo Play, Run and 1-to-8 client multiplayer tests. | Full engine integration tests, disconnect cleanup and physics/remote verification. | Requires Roblox Studio; not natively available on Linux CI runners. |
| Lune (pure Luau) | Standalone Luau runtime (lune-org/lune, MPL-2.0, active) running pure logic locally or in CI in under a second. | Fast feedback on pure modules (migrations, token buckets, economy math) without Roblox instances. | No Roblox engine APIs unless stubbed. |
| Roblox/jest-roblox vs jsdotlua/jest-lua | Roblox/jest-roblox (MIT, active, Wally roblox/jest@3.21.0) vs jsdotlua/jest-lua (MIT, quiet since Dec 2024, Wally jsdotlua/jest@3.10.0 in Beacon Yard). TestEZ (Apache-2.0) is archived: do not use. | Unit and contract test suites inside Studio or a Luau harness; prefer roblox/jest for new projects. | Jest.runCLI relies on Edit-mode module loading; run-in-roblox (MIT, stale since Mar 2024) should be avoided in favour of Open Cloud. |
Match each Beacon Yard bug to the cheapest test layer that catches it reliably.
Answer
A v1 profile with decimal coins fails to round down: Pure-Luau migration corpus test; A Rojo project.json typo drops ReceiptRules from the built place: Open Cloud Luau Execution smoke test on the built place; Eight players touching Pad1 at once leaves a stuck debounce: StudioTestService multiplayer test; A per-player table grows by 4 KB on every leave over 500 visits: Nightly soak test with heap-growth gate. Pure math belongs in instant unit/corpus tests; build assembly belongs in cloud Luau Execution; multi-client engine interaction needs StudioTestService; slow leaks need a soak test.
Open this step in lesson mode · Link to this step · This confused me
8Build along: wire cloud CI, corpus checks and a soak gate
Extend your copy of Beacon Yard from m14-ship on a branch. Start with the pure-logic harness in challenges/work/test_harness.luau, then add the migration corpus and CI job in your local copy.
unit/specs/DataMigration.spec.luausrc/server/DataMigration.luautasks/run-specs.luautasks/smoke.luauscripts/lune/smoke.luauscripts/run-luau-tests.mjs.github/workflows/ci.yml
Use
v1_record,m10_profile,m12_profileandm14_profileinunit/specs/DataMigration.spec.luau. Copy each fixture before invokingDataMigration.reconcileand compare once and twice reconciled copies. Separately check thatDataMigration.applyimports the v1 record only once.You should see Four historical record shapes reconcile into complete profiles and pass the idempotence test.
Validate the content with
ContentSchemaand round-trip aDronePacket. UseScopeto register cleanup across 200 simulated cycles, then check the cleanup count and remaining entries. Runlune run scripts/lune/smokelocally. The soak checks leftover entries, while the challenge below practises a heap growth budget.You should see The smoke script checks content, a packet round trip and 200 join and leave cycles.
Use the
luau-executionjob in.github/workflows/ci.yml. It buildstest.project.json, publishesbuild/beacon-yard-tests.rbxl, and passes the published version toscripts/run-luau-tests.mjs. The runner checks for task completion and the task's pass or fail marker. The job skips the cloud steps unless all three test secrets are configured, and its result stays advisory until it has passed once; the Lunespecsjob is the merge gate.You should see The trusted CI job publishes the test place and runs the spec and smoke tasks separately.
Open this step in lesson mode · Link to this step · This confused me
9Challenges
Level 2, Builder
Challenge
Write a one-page Testing & Quarantine Policy (docs/testing-policy.md in your copy of Beacon Yard). This is a self-check; no automated test grades it.
- Start from
- The game at milestone m14 (download)
Done means
- A three-tier test matrix (every PR, merge to main, nightly/pre-release) naming exact tools, budgets and target places
- A secret-safety rule explaining why fork PRs never read TEST_ROBLOX_API_KEY
- A flaky-test quarantine rule with owner assignment, tracking issue and maximum days before fix or removal
- At least four concrete soak thresholds (heap growth %, p95 server tick ms, cycle count, zero unexpected Output errors)
Hints
- Keep PR checks under 3 minutes so developers do not bypass them.
- Name the exact CI place vs staging place vs production place so tests never write to player DataStores.
- Define what happens automatically when a quarantined test misses its expiry date.
Level 3, Professional
Challenge
Complete challenges/work/test_harness.luau so the migration corpus runner, two-server session lock simulator, soak gate and cloud log parser pass every check. Run game.ServerScriptService.RunGameTests:Invoke("testing-at-scale", "testing-at-scale-suite") in Studio (or test in the pure Luau runner). Written solution: challenges/solutions/testing-at-scale.md.
- Start from
- The game at milestone m14 (download)
- Grade it
- In Studio, press Play, then run
game.ServerScriptService.RunGameTests:Invoke("testing-at-scale", "testing-at-scale-suite")in the server command bar. Copy the pass code from Output.
Done means
- verifyCorpus checks expected coins and speedOwned, non-negative integer coins, and idempotence (second migrate matches first)
- acquire, write and release enforce single-server lease ownership, expiry takeover and stale-server write rejection
- evaluateSoak skips warmupCount samples, requires at least 2 post-warmup samples, and checks both heap growth percentage and p95 tick time
- parseCloudLog returns ok = true only when TEST SUITE DONE is present, failed == 0, and passed > 0
- challenges/testing-at-scale.luau prints TEST PASS for all 13 checks
Hints
- In verifyCorpus, pass the table returned by the first migrateFn(fixture.raw) directly back into migrateFn(first).
- In evaluateSoak, sort a copy of post-warmup tickMs values and pick index math.ceil(0.95 * #ticks).
- In parseCloudLog, check exact line equality for 'TEST SUITE DONE' and string.sub(line, 1, 10) for 'TEST PASS ' and 'TEST FAIL '.
Open this step in lesson mode · Link to this step · This confused me
10Recap
Retiring the analogy
You no longer need “a wind tunnel and crash-test sled run before every flight”. Automated cloud tests, bots and soak runs prove that builds load, data survives migrations and servers hold steady under load, freeing human playtesters to judge fun, clarity and edge-case behaviour.
Recap
- Run Lune checks without cloud credentials. The cloud runner uses a dedicated test place and checks the task state plus the unit or smoke completion marker. The challenge's parser also requires a positive pass count.
- Freeze every shipped save shape in a migration fixture corpus and assert both data preservation and idempotence (migrate twice equals migrate once).
- Simulate two-server session lock handoffs and DataStore failure injection in pure Luau, and use StudioTestService (up to 8 clients) for live multiplayer disconnect and concurrency checks.
- Run soak tests that skip warm-up allocations and gate on steady-state heap growth and p95 tick time, and quarantine flaky tests with an owner and expiry instead of blindly clicking re-run.
Automated cloud CI, bots and soak tests is a wind tunnel and crash-test sled run before every flight, until a crash dummy never gets bored, never misreads a confusing shop label, and never invents a creative social exploit that real players will find in ten minutes.
Queued for review
- In Beacon Yard's .github/workflows/ci.yml at m14-ship, what happens to build/beacon-yard-tests.rbxlx after rojo build creates it?
- A Luau Execution task finishes with state COMPLETE and logs: ["Booting", "TEST PASS migration_v1"]. It crashes silently before printing TEST SUITE DONE. What must your CI gate return?
- A v4 migration gives returning v3 players a one-time 50-coin thank-you bonus, but forgets to record a flag or bump the version field. Which corpus check catches the bug immediately?
- In the Run cell above, suppose Server B's lease was 60 seconds starting at t=125 (so expiresAt = 185). Server B hangs and misses its heartbeat. At t=190, Server C calls acquire("Player_42", "srvC", 190, 60), then Server B wakes up at t=191 and calls writeCoins("Player_42", "srvB", 191, 25). What happens?
Open this step in lesson mode · Link to this step · This confused me