Skip to content

TestService

Supported Class Services Service

A service used by Roblox to run controlled tests of the engine. It is available for developers to use, to a limited degree.

22 Nova members · 28 modern Roblox members not implemented yet

Description

TestService is a service used by Roblox internally to run analytical tests on the engine.

Scripts that are executed inside of TestService (via TestService.RunAsync()) have access to special macros that directly invoke functions under the service. Macros are essentially substitutions for large blocks of code that shouldn't need to be rewritten each time you want to call them.

RBX_CHECK

This macro does tests with calls to the TestService.Check() function.

Macro Test Condition
RBX_CHECK(cond) cond == true
RBX_CHECK_MESSAGE(cond, failMsg) cond == true
RBX_CHECK_THROW(CODE) pcall(function() CODE end) == false
RBX_CHECK_NO_THROW(CODE) pcall(function() CODE end) == true
RBX_CHECK_EQUAL(a, b) a == b
RBX_CHECK_NE(a, b) a ~= b
RBX_CHECK_GE(a, b) a >= b
RBX_CHECK_LE(a, b) a <= b
RBX_CHECK_GT(a, b) a > b
RBX_CHECK_LT(a, b) a < b

RBX_REQUIRE

This macro does tests with calls to the TestService.Require() function.

Macro Test Condition
RBX_REQUIRE(cond) cond == true
RBX_REQUIRE_MESSAGE(cond, failMsg) cond == true
RBX_REQUIRE_THROW(CODE) pcall(function() CODE end) == false
RBX_REQUIRE_NO_THROW(CODE) pcall(function() CODE end) == true
RBX_REQUIRE_EQUAL(a, b) a == b
RBX_REQUIRE_NE(a, b) a ~= b
RBX_REQUIRE_GE(a, b) a >= b
RBX_REQUIRE_LE(a, b) a <= b
RBX_REQUIRE_GT(a, b) a > b
RBX_REQUIRE_LT(a, b) a < b

RBX_WARN

This macro does tests with calls to the TestService.Warn() function.

Macro Test Condition
RBX_WARN(cond) cond == true
RBX_WARN_MESSAGE(cond, failMsg) cond == true
RBX_WARN_THROW(CODE) pcall(function() CODE end) == false
RBX_WARN_NO_THROW(CODE) pcall(function() CODE end) == true
RBX_WARN_EQUAL(a, b) a == b
RBX_WARN_NE(a, b) a ~= b
RBX_WARN_GE(a, b) a >= b
RBX_WARN_LE(a, b) a <= b
RBX_WARN_GT(a, b) a > b
RBX_WARN_LT(a, b) a < b

Additional Macros

Macro Description
RBX_ERROR(msg) Directly calls the Class.TestService:Error() function.
RBX_FAIL(msg) Directly calls the Class.TestService:Fail() function.
RBX_MESSAGE(msg) Directly calls the Class.TestService:Message() function.

Inheritance

Object → Instance → TestService

Nova inheritance: Instance → TestService

Properties

AutoRuns Supported Property If set to true, the game will start running when the service's TestService.RunAsync() method is called.
AutoRuns: bool

If set to true, the game will start running when the service's TestService.RunAsync() method is called.

Roblox documentation

Description Supported Property A description of the test being executed.
Description: string

A description of the test being executed.

Roblox documentation

ErrorCount Supported Property Measures how many errors have been recorded in the test session.
ErrorCount: int

Measures how many errors have been recorded in the test session.

Roblox documentation

Is30FpsThrottleEnabled Supported Property Deprecated Sets whether or not the physics engine should be throttled to 30 FPS while the test is being ran.
Is30FpsThrottleEnabled: bool

Sets whether or not the physics engine should be throttled to 30 FPS while the test is being ran.

Roblox documentation

IsPhysicsEnvironmentalThrottled Supported Property Sets whether or not the physics environment should be throttled while running this test.
IsPhysicsEnvironmentalThrottled: bool

Sets whether or not the physics environment should be throttled while running this test.

Roblox documentation

IsSleepAllowed Supported Property Sets whether or not physics objects will be allowed to fall asleep while the test simulation is running.
IsSleepAllowed: bool

Sets whether or not physics objects will be allowed to fall asleep while the test simulation is running.

Roblox documentation

NumberOfPlayers Supported Property The number of players expected in this test, if any.
NumberOfPlayers: int

The number of players expected in this test, if any.

Roblox documentation

SimulateSecondsLag Supported Property Sets a specific amount of additional latency experienced by players during the test session.
SimulateSecondsLag: double

Sets a specific amount of additional latency experienced by players during the test session.

Roblox documentation

TestCount Supported Property Measures how many test calls have been recorded in the test session.
TestCount: int

Measures how many test calls have been recorded in the test session.

Roblox documentation

Timeout Supported Property The maximum amount of time that tests are allowed to run for.
Timeout: double

The maximum amount of time that tests are allowed to run for.

Roblox documentation

WarnCount Supported Property Measures how many warning calls have been recorded in the test session.
WarnCount: int

Measures how many warning calls have been recorded in the test session.

Roblox documentation

Methods

Check Supported Function Prints result of a condition to the output.
TestService:Check(bool condition, string description, Instance source = nil, int line = 0)

Prints result of a condition to the output.

If condition is true, prints Check passed: followed by description to the output in blue text. Otherwise, prints Check failed: followed by description in red text.

Roblox reference signature
TestService:Check(condition: bool, description: string, source: Instance = nil, line: int = 0): null

Roblox documentation

Checkpoint Supported Function Prints Test checkpoint: followed by a string to the output in blue text.
TestService:Checkpoint(string text, Instance source = nil, int line = 0)

Prints Test checkpoint: followed by a string to the output in blue text.

Prints Test checkpoint: followed by text to the output in blue text.

Roblox reference signature
TestService:Checkpoint(text: string, source: Instance = nil, line: int = 0): null

Roblox documentation

Done Supported Function Prints Testing Done to the output in blue text.
TestService:Done()

Prints Testing Done to the output in blue text.

Roblox reference signature
TestService:Done(): null

Roblox documentation

Error Supported Function Prints a red error message to the output, prefixed by TestService: .
TestService:Error(string description, Instance source = nil, int line = 0)

Prints a red error message to the output, prefixed by TestService:.

Prints a red error message (description) to the output, prefixed by TestService:.

Roblox reference signature
TestService:Error(description: string, source: Instance = nil, line: int = 0): null

Roblox documentation

Fail Supported Function Indicates a fatal error in a TestService run.
TestService:Fail(string description, Instance source = nil, int line = 0)

Indicates a fatal error in a TestService run. If this is called inside of a script running inside the service, it will initiate a breakpoint on the line that invoked the error.

Roblox reference signature
TestService:Fail(description: string, source: Instance = nil, line: int = 0): null

Roblox documentation

Message Supported Function Prints TestService: followed by a string to the output in blue text.
TestService:Message(string text, Instance source = nil, int line = 0)

Prints TestService: followed by a string to the output in blue text.

Prints TestService: followed by text to the output in blue text.

Roblox reference signature
TestService:Message(text: string, source: Instance = nil, line: int = 0): null

Roblox documentation

Require Supported Function Prints whether a condition is true along with a description string.
TestService:Require(bool condition, string description, Instance source = nil, int line = 0)

Prints whether a condition is true along with a description string.

If condition is true, prints Require passed: followed by description to the output in blue text. Otherwise prints Require failed. Test ended: followed by description in red text.

Roblox reference signature
TestService:Require(condition: bool, description: string, source: Instance = nil, line: int = 0): null

Roblox documentation

Run Supported Function Deprecated Runs scripts which are parented to TestService.
TestService:Run()

Runs scripts which are parented to TestService.

Roblox reference signature
TestService:Run(): null
Security: PluginSecurity

Roblox documentation

Warn Supported Function Prints if a condition is true, otherwise prints a warning.
TestService:Warn(bool condition, string description, Instance source = nil, int line = 0)

Prints if a condition is true, otherwise prints a warning.

If condition is true, prints Warning passed: followed by description to the output in blue text. Otherwise prints Warning: followed by description to the output in yellow text.

Roblox reference signature
TestService:Warn(condition: bool, description: string, source: Instance = nil, line: int = 0): null

Roblox documentation

Events

ServerCollectConditionalResult Supported Event Fires when the server should collect a conditional test result.
ServerCollectConditionalResult(bool condition, string text, Instance script, int line)

Fires when the server should collect a conditional test result.

Roblox reference signature
ServerCollectConditionalResult(condition: bool, text: string, script: Instance, line: int)

Roblox documentation

ServerCollectResult Supported Event Fires when the server should collect a test result.
ServerCollectResult(string text, Instance script, int line)

Fires when the server should collect a test result.

Roblox reference signature
ServerCollectResult(text: string, script: Instance, line: int)

Roblox documentation

Inherited members

Inherited from Instance: 8 properties, 36 methods, 7 events. They are documented on the base class page.

28 modern Roblox member(s) are not implemented yet — expand to inspect

Members declared by Roblox's TestService class (or by a missing base class) that Nova does not expose. Use this list to scope a migration; the compatibility guide has the recommended workaround.

Properties

Member Signature Status Notes Flags
ExecuteWithStudioRun ExecuteWithStudioRun: bool Not yet When set to true, TestService will be executed when using the Run action in Roblox Studio. —
ThrottlePhysicsToRealtime ThrottlePhysicsToRealtime: bool Not yet Sets whether the test should be throttled to simulate time according to real world time or as fast as possible. —

Methods

Member Signature Status Notes Flags
CaptureScreenshotAsync TestService:CaptureScreenshotAsync(artifactName: string, options: Dictionary = nil): Tuple Not yet — Yields
ConvertSlimAcrToObj TestService:ConvertSlimAcrToObj(acrFullFilePath: string, objFileName: string): string Not yet — RobloxScriptSecurity
CreateAndSavePropertySet TestService:CreateAndSavePropertySet(source: Instance): string Not yet — RobloxScriptSecurity
CreateExtraAssetsFileFromPropertySet TestService:CreateExtraAssetsFileFromPropertySet(psetFileName: string): string Not yet — RobloxScriptSecurity
FetchExtraAssets TestService:FetchExtraAssets(extraAssetsFileName: string): string Not yet — RobloxScriptSecurity
FetchTestControlsAsync TestService:FetchTestControlsAsync(category: string): Tuple Not yet — Yields
GetTestControls TestService:GetTestControls(providerName: string): Dictionary Not yet — —
GetTestControlSchema TestService:GetTestControlSchema(providerName: string): Dictionary Not yet — —
getTestSessionProviderStats TestService:getTestSessionProviderStats(providerName: string): Dictionary Not yet — —
isFeatureEnabled TestService:isFeatureEnabled(name: string): bool Not yet Returns whether the named feature identified by name is currently enabled. —
RegisterTest TestService:RegisterTest(testOptions: Dictionary): TestCase Not yet — —
RegisterTestLegacy TestService:RegisterTestLegacy(testOptions: Dictionary): TestCase Not yet — —
RequestValidationAsync TestService:RequestValidationAsync(module: string, artifactName: string, options: Variant): Tuple Not yet — Yields
ResetTestControl TestService:ResetTestControl(providerName: string, controlName: string): null Not yet — —
RunAsync TestService:RunAsync(): null Not yet Runs scripts which are parented to TestService. Yields, PluginSecurity
ScopeTime TestService:ScopeTime(): Dictionary Not yet Returns a dictionary of per-scope physics simulation timings for performance testing. —
SetTestControl TestService:SetTestControl(providerName: string, controlName: string, value: Variant): null Not yet — —
SignalProfilingCapture TestService:SignalProfilingCapture(target: string, options: Dictionary = nil): null Not yet — —
SignalProfilingStart TestService:SignalProfilingStart(target: string, options: Dictionary = nil): null Not yet — —
SignalProfilingStop TestService:SignalProfilingStop(target: string): null Not yet — —
StartTestSession TestService:StartTestSession(): null Not yet — —
StartVideoCaptureAsync TestService:StartVideoCaptureAsync(artifactName: string, options: Dictionary = nil): Tuple Not yet — Yields
StopTestSession TestService:StopTestSession(): null Not yet — —
StopVideoCaptureAsync TestService:StopVideoCaptureAsync(): Tuple Not yet — Yields
TakeSnapshot TestService:TakeSnapshot(snapshotname: string, source: Instance = nil): null Not yet — —
TranscodePropertySet TestService:TranscodePropertySet(extraAssetsFileName: string, psetFileName: string): string Not yet — RobloxScriptSecurity

Roblox reference: TestService

Generated from Nova's API dump and Roblox creator-docs. Nova-only members come from the engine's reflection metadata.