StudioTestService¶
Service allowing plugins to automate and customize Test and Run mode testing.
Not implemented yet
This class exists in the current Roblox API but is not implemented in Nova yet. Scripts that reference it will fail at runtime.
Description¶
StudioTestService allows plugins to automate and customize Test and Run mode
testing. With StudioTestService, your plugins can launch tests that jump
straight to a specific part of your game, or run complex code tests
automatically.
You can use StudioTestService to start a server with multiple simulated
clients, add players mid-session, pass arguments into running tests, end tests
from the server, and trigger client disconnections, all without manually
clicking through the Test tab in Studio.
These methods complement the existing playtest automation available through
Studio's built-in MCP server. Where the MCP server's start_stop_play tool
starts a single Play Client session, the StudioTestService methods are
designed for scripted multi-client scenarios such as lobby, matchmaking, and
join/leave flow testing.
A typical multiplayer test splits across three script contexts: the plugin that launches it, the server that drives it, and the clients that participate:
Plugin script:
local StudioTestService = game:GetService("StudioTestService")
local toolbar = plugin:CreateToolbar("STS Tests")
local button = toolbar:CreateButton("MyTest", "", "")
button.Click:Connect(function()
button.Enabled = false
local result = StudioTestService:ExecuteMultiplayerTestAsync(1, "MyArguments")
assert(result == "Success!")
print("Test finished successfully!")
button.Enabled = true
end)
Server script:
local Players = game:GetService("Players")
local StudioTestService = game:GetService("StudioTestService")
assert(StudioTestService:GetTestArgs() == "MyArguments")
Players.PlayerRemoving:Connect(function(player)
print(player.Name .. " left the experience")
task.wait(3)
StudioTestService:EndTest("Success!")
end)
Client script:
if not game:IsLoaded() then
game.Loaded:Wait()
end
local StudioTestService = game:GetService("StudioTestService")
task.wait(3)
StudioTestService:LeaveTest()
Limitations¶
ExecuteMultiplayerTestAsynccan only be called from plugin scripts. It yields until the test ends, so wrap it in a coroutine if the calling plugin needs to remain responsive.ExecuteMultiplayerTestAsynccannot be called from inside a running test.ExecuteMultiplayerTestAsyncsupports up to 8 simulated clients per test session.- Only one multiplayer test session can run at a time per Studio instance.
AddPlayersandEndTestmust be called from the server DataModel of a running test.CanLeaveTestandLeaveTestmust be called from a client DataModel.GetTestArgscurrently has a known issue when called from a client LocalScript.
Inheritance¶
Object โ Instance โ StudioTestService
Properties¶
| Member | Signature | Summary |
|---|---|---|
EditModeActive |
EditModeActive: bool |
Plugin-facing. Indicates whether the session is the idle edit DataModel with no Studio test session running. |
Methods¶
| Member | Signature | Summary |
|---|---|---|
AddPlayers |
StudioTestService:AddPlayers(numPlayers: int): null |
Adds additional simulated clients to the running multiplayer test session. |
CanLeaveTest |
StudioTestService:CanLeaveTest(): bool |
Returns whether the calling client DataModel can disconnect from the test. |
EndTest |
StudioTestService:EndTest(value: Variant): null |
Ends the current Studio test session from the server DataModel. |
ExecuteMultiplayerTestAsync |
StudioTestService:ExecuteMultiplayerTestAsync(numPlayers: int, args: Variant): Variant |
Launches a multiplayer test session and yields until it completes. |
ExecutePlayModeAsync |
StudioTestService:ExecutePlayModeAsync(args: Variant): Variant |
Starts a solo Test session and yields until it ends. |
ExecuteRunModeAsync |
StudioTestService:ExecuteRunModeAsync(args: Variant): Variant |
Starts a Run test session and yields until it ends. |
GetTestArgs |
StudioTestService:GetTestArgs(): Variant |
Returns the argument passed to the method that started the current test session. |
LeaveTest |
StudioTestService:LeaveTest(): null |
Disconnects the calling client from the active multiplayer test. |
Roblox reference: StudioTestService
Generated from Nova's API dump and Roblox creator-docs. Nova-only members come from the engine's reflection metadata.