Service · inherits Instance
TestService
A service used by Roblox to run controlled tests of the engine. It is available for developers to use, to a limited degree.
About TestService
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.
RBX_REQUIRE
This macro does tests with calls to the TestService.Require
function.
RBX_WARN
This macro does tests with calls to the TestService.Warn function.
Additional Macros
Properties 12
AutoRuns
: booleanIf set totrue, the game will start running when the service'sTestService.RunAsyncmethod is called.Description
: stringA description of the test being executed.ErrorCount
: intReadOnlyNotReplicatedMeasures how many errors have been recorded in the test session.ExecuteWithStudioRun
: booleanWhen set totrue,TestServicewill be executed when using the Run action in Roblox Studio.When set to
true,TestServicewill be executed when using the Run action in Roblox Studio.Note that if the
NumberOfPlayersproperty is set to a value above0, running the game will openNumberOfPlayers + 1Studio windows where one window is a server and the rest are players connected to that server. Try to keep this value within a rational range (1 to 8 players) or else your computer's CPU will get overloaded.IsPhysicsEnvironmentalThrottled
: booleanSets whether or not the physics environment should be throttled while running this test.IsSleepAllowed
: booleanSets whether or not physics objects will be allowed to fall asleep while the test simulation is running.NumberOfPlayers
: intThe number of players expected in this test, if any.SimulateSecondsLag
: doubleSets a specific amount of additional latency experienced by players during the test session.TestCount
: intReadOnlyNotReplicatedMeasures how many test calls have been recorded in the test session.ThrottlePhysicsToRealtime
: booleanSets whether the test should be throttled to simulate time according to real world time or as fast as possible.Timeout
: doubleThe maximum amount of time that tests are allowed to run for.WarnCount
: intReadOnlyNotReplicatedMeasures how many warning calls have been recorded in the test session.
Methods 11
Check
(condition: boolean, description: string, source: Instance = nil, line: int = 0) → ()Prints result of a condition to the output.If
conditionistrue, printsCheck passed:followed bydescriptionto the output in blue text. Otherwise, printsCheck failed:followed bydescriptionin red text.Checkpoint
(text: string, source: Instance = nil, line: int = 0) → ()PrintsTest checkpoint:followed by a string to the output in blue text.Prints
Test checkpoint:followed bytextto the output in blue text.Done
() → ()PrintsTesting Doneto the output in blue text.Error
(description: string, source: Instance = nil, line: int = 0) → ()Prints a red error message to the output, prefixed byTestService:.Prints a red error message (
description) to the output, prefixed byTestService:.Fail
(description: string, source: Instance = nil, line: int = 0) → ()Indicates a fatal error in aTestServicerun.Indicates a fatal error in a
TestServicerun. If this is called inside of a script running inside the service, it will initiate a breakpoint on the line that invoked the error.isFeatureEnabled
(name: string) → booleanReturns whether the named feature identified bynameis currently enabled.Returns
trueif the feature identified bynameis set totrue, andfalseif it is set to any other value. Raises an error ifnamedoesn't correspond to a defined feature.Message
(text: string, source: Instance = nil, line: int = 0) → ()PrintsTestService:followed by a string to the output in blue text.Prints
TestService:followed bytextto the output in blue text.Require
(condition: boolean, description: string, source: Instance = nil, line: int = 0) → ()Prints whether a condition is true along with a description string.If
conditionistrue, printsRequire passed:followed bydescriptionto the output in blue text. Otherwise printsRequire failed. Test ended:followed bydescriptionin red text.RunAsync
() → ()YieldsPluginRuns scripts which are parented toTestService.ScopeTime
() → DictionaryReturns a dictionary of per-scope physics simulation timings for performance testing.Returns a dictionary mapping physics simulation scopes to their measured step times, used for per-scope physics performance testing. Raises an error if the caller lacks permission.
Warn
(condition: boolean, description: string, source: Instance = nil, line: int = 0) → ()Prints if a condition istrue, otherwise prints a warning.If
conditionistrue, printsWarning passed:followed bydescriptionto the output in blue text. Otherwise printsWarning:followed bydescriptionto the output in yellow text.
Events 2
ServerCollectConditionalResult
TestService.ServerCollectConditionalResult:Connect(function(condition, text, script, line))Fires when the server should collect a conditional test result.ServerCollectResult
TestService.ServerCollectResult:Connect(function(text, script, line))Fires when the server should collect a test result.
TestService also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.