TestService
A service used by Roblox to run controlled tests of the engine. It is available for developers to use, to a limited degree.
Memory category | Instances |
---|
Member index 25
Removed member index 4
History | Member | |
---|---|---|
214 | DoCommand(name: string): void | |
214 | GetCommandNames(): Array | |
214 | IsCommandChecked(name: string): bool | |
214 | IsCommandEnabled(name: string): bool |
Description
The TestService is a service used by Roblox internally to run analytical tests on their engine. It makes it possible to write sophisticated tests right inside a game.
Macros
Scripts that are executed inside of the TestService (via TestService:Run()) have access to special macros that directly invoke functions under the TestService. 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 TestService:Error() function. |
RBX_FAIL(msg) | Directly calls the TestService:Fail() function. |
RBX_MESSAGE(msg) | Directly calls the TestService:Message() function. |
History 116
- 640 Change CanSave of IsPhysicsEnvironmentalThrottled from false to true
- 640 Change Tags of IsPhysicsEnvironmentalThrottled from [Hidden, NotReplicated] to []
- 640 Change Tags of Is30FpsThrottleEnabled from [Hidden, NotReplicated] to []
- 640 Change CanSave of Is30FpsThrottleEnabled from false to true
- 590 Change Tags of IsPhysicsEnvironmentalThrottled from [] to [Hidden, NotReplicated]
- 590 Change CanSave of IsPhysicsEnvironmentalThrottled from true to false
- 590 Change Tags of Is30FpsThrottleEnabled from [] to [Hidden, NotReplicated]
- 590 Change CanSave of Is30FpsThrottleEnabled from true to false
- 573 Change ReturnType of Warn from void to null
- 573 Change ReturnType of Run from void to null
- 573 Change ReturnType of Require from void to null
- 573 Change ReturnType of Message from void to null
- 573 Change ReturnType of Fail from void to null
- 573 Change ReturnType of Error from void to null
- 573 Change ReturnType of Done from void to null
- 573 Change ReturnType of Checkpoint from void to null
- 573 Change ReturnType of Check from void to null
- 553 Change Default of WarnCount from to 0
- 553 Change Default of Timeout from to 10
- 553 Change Default of TestCount from to 0
- 553 Change Default of SimulateSecondsLag from to 0
- 553 Change Default of NumberOfPlayers from to 0
- 553 Change Default of IsSleepAllowed from to true
- 553 Change Default of IsPhysicsEnvironmentalThrottled from to true
- 553 Change Default of Is30FpsThrottleEnabled from to true
- 553 Change Default of ExecuteWithStudioRun from to false
- 553 Change Default of ErrorCount from to 0
- 553 Change Default of AutoRuns from to true
- 486 Add ScopeTime
- 486 Change ThreadSafety of WarnCount from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Timeout from ReadOnly to ReadSafe
- 486 Change ThreadSafety of TestCount from ReadOnly to ReadSafe
- 486 Change ThreadSafety of SimulateSecondsLag from ReadOnly to ReadSafe
- 486 Change ThreadSafety of NumberOfPlayers from ReadOnly to ReadSafe
- 486 Change ThreadSafety of IsSleepAllowed from ReadOnly to ReadSafe
- 486 Change ThreadSafety of IsPhysicsEnvironmentalThrottled from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Is30FpsThrottleEnabled from ReadOnly to ReadSafe
- 486 Change ThreadSafety of ExecuteWithStudioRun from ReadOnly to ReadSafe
- 486 Change ThreadSafety of ErrorCount from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Description from ReadOnly to ReadSafe
- 486 Change ThreadSafety of AutoRuns from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ServerCollectResult from to Unsafe
- 462 Change ThreadSafety of ServerCollectConditionalResult from to Unsafe
- 462 Change ThreadSafety of isFeatureEnabled from to Unsafe
- 462 Change ThreadSafety of Warn from to Unsafe
- 462 Change ThreadSafety of Run from to Unsafe
- 462 Change ThreadSafety of Require from to Unsafe
- 462 Change ThreadSafety of Message from to Unsafe
- 462 Change ThreadSafety of Fail from to Unsafe
- 462 Change ThreadSafety of Error from to Unsafe
- 462 Change ThreadSafety of Done from to Unsafe
- 462 Change ThreadSafety of Checkpoint from to Unsafe
- 462 Change ThreadSafety of Check from to Unsafe
- 462 Change ThreadSafety of WarnCount from to ReadOnly
- 462 Change ThreadSafety of Timeout from to ReadOnly
- 462 Change ThreadSafety of TestCount from to ReadOnly
- 462 Change ThreadSafety of SimulateSecondsLag from to ReadOnly
- 462 Change ThreadSafety of NumberOfPlayers from to ReadOnly
- 462 Change ThreadSafety of IsSleepAllowed from to ReadOnly
- 462 Change ThreadSafety of IsPhysicsEnvironmentalThrottled from to ReadOnly
- 462 Change ThreadSafety of Is30FpsThrottleEnabled from to ReadOnly
- 462 Change ThreadSafety of ExecuteWithStudioRun from to ReadOnly
- 462 Change ThreadSafety of ErrorCount from to ReadOnly
- 462 Change ThreadSafety of Description from to ReadOnly
- 462 Change ThreadSafety of AutoRuns from to ReadOnly
- 349 Add isFeatureEnabled
- 337 Add ExecuteWithStudioRun
- 214 Remove IsCommandEnabled
- 214 Remove IsCommandChecked
- 214 Remove GetCommandNames
- 214 Remove DoCommand
- 178 Add SimulateSecondsLag
- 151 Change Security of Run from LocalUserSecurity to PluginSecurity
- 95 Add ServerCollectResult
- 95 Add ServerCollectConditionalResult
- 95 Add NumberOfPlayers
- 94 Remove ServerCollectResult
- 94 Remove ServerCollectConditionalResult
- 94 Remove NumberOfPlayers
- 95 Add ServerCollectResult
- 95 Add ServerCollectConditionalResult
- 95 Add NumberOfPlayers
- 94 Remove ServerCollectResult
- 94 Remove ServerCollectConditionalResult
- 94 Remove NumberOfPlayers
- 95 Add ServerCollectResult
- 95 Add ServerCollectConditionalResult
- 95 Add NumberOfPlayers
- 57 Add IsCommandEnabled
- 57 Add IsCommandChecked
- 57 Add GetCommandNames
- 57 Add DoCommand
- 52 Change Parameters of Warn from (condition: bool, description: string) to (condition: bool, description: string, source: Instance = Instance, line: int = 0)
- 52 Add Run
- 52 Change Parameters of Require from (condition: bool, description: string) to (condition: bool, description: string, source: Instance = Instance, line: int = 0)
- 52 Change Parameters of Message from (text: string) to (text: string, source: Instance = Instance, line: int = 0)
- 52 Add Fail
- 52 Add Error
- 52 Change Parameters of Checkpoint from (text: string) to (text: string, source: Instance = Instance, line: int = 0)
- 52 Change Parameters of Check from (condition: bool, description: string) to (condition: bool, description: string, source: Instance = Instance, line: int = 0)
- 52 Add WarnCount
- 52 Add TestCount
- 52 Add ErrorCount
- 52 Add AutoRuns
- 51 Add Warn
- 51 Add Require
- 51 Add Message
- 51 Add Done
- 51 Add Checkpoint
- 51 Add Check
- 51 Add Timeout
- 51 Add IsSleepAllowed
- 51 Add IsPhysicsEnvironmentalThrottled
- 51 Add Is30FpsThrottleEnabled
- 51 Add Description
- 51 Add TestService
Members 25
AutoRuns
Type | Default | |
---|---|---|
bool | true |
If set to true, the game will start running when the TestService's TestService:Run() method is called.
Thread safety | ReadSafe |
---|---|
Category | Physics |
Loaded/Saved | true |
Check
Parameters (4) | Default | |
---|---|---|
condition | bool | |
description | string | |
source | Instance | Instance |
line | int | 0 |
Returns (1) | ||
null |
If condition is true, prints "Check passed: ", followed by description to the output, in blue text. Otherwise, prints "Check failed: ", again, followed by description, but in red text.
Thread safety | Unsafe |
---|
Checkpoint
Parameters (3) | Default | |
---|---|---|
text | string | |
source | Instance | Instance |
line | int | 0 |
Returns (1) | ||
null |
Prints "Test checkpoint: ", followed by text, to the output, in blue text.
Thread safety | Unsafe |
---|
History 4
- 573 Change ReturnType of Checkpoint from void to null
- 462 Change ThreadSafety of Checkpoint from to Unsafe
- 52 Change Parameters of Checkpoint from (text: string) to (text: string, source: Instance = Instance, line: int = 0)
- 51 Add Checkpoint
Description
Type | Default | |
---|---|---|
string |
A description of the test being executed.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 3
- 486 Change ThreadSafety of Description from ReadOnly to ReadSafe
- 462 Change ThreadSafety of Description from to ReadOnly
- 51 Add Description
Done
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Prints Testing Done to the output, in blue text.
Thread safety | Unsafe |
---|
Error
Parameters (3) | Default | |
---|---|---|
description | string | |
source | Instance | Instance |
line | int | 0 |
Returns (1) | ||
null |
Prints a red message to the output, prefixed by TestService:
.
Thread safety | Unsafe |
---|
ErrorCount
Type | Default | |
---|---|---|
int | 0 |
Measures how many errors have been recorded in the test session.
Thread safety | ReadSafe |
---|---|
Category | Results |
Loaded/Saved | false/true |
History 4
- 553 Change Default of ErrorCount from to 0
- 486 Change ThreadSafety of ErrorCount from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ErrorCount from to ReadOnly
- 52 Add ErrorCount
ExecuteWithStudioRun
Type | Default | |
---|---|---|
bool | false |
When set to true, the TestService will be executed when using the Run action in Roblox Studio.
Note:
- If the TestService.NumberOfPlayers property is set to a value
above 0, running the game will open
NumberOfPlayers + 1
studio 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 at most), or else your computer's CPU will get overloaded.
Thread safety | ReadSafe |
---|---|
Category | Settings |
Loaded/Saved | true |
History 4
- 553 Change Default of ExecuteWithStudioRun from to false
- 486 Change ThreadSafety of ExecuteWithStudioRun from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ExecuteWithStudioRun from to ReadOnly
- 337 Add ExecuteWithStudioRun
Fail
Parameters (3) | Default | |
---|---|---|
description | string | |
source | Instance | Instance |
line | int | 0 |
Returns (1) | ||
null |
Indicates a fatal error in a TestService run. If this is called inside of a script running inside of the TestService, this will initiate a breakpoint on the line that invoked the error.
Thread safety | Unsafe |
---|
Is30FpsThrottleEnabled
Type | Default | |
---|---|---|
bool | true |
Sets whether or not the physics engine should be throttled to 30 FPS while the test is being ran.
Thread safety | ReadSafe |
---|---|
Category | Physics |
Loaded/Saved | true |
History 8
- 640 Change Tags of Is30FpsThrottleEnabled from [Hidden, NotReplicated] to []
- 640 Change CanSave of Is30FpsThrottleEnabled from false to true
- 590 Change Tags of Is30FpsThrottleEnabled from [] to [Hidden, NotReplicated]
- 590 Change CanSave of Is30FpsThrottleEnabled from true to false
- 553 Change Default of Is30FpsThrottleEnabled from to true
- 486 Change ThreadSafety of Is30FpsThrottleEnabled from ReadOnly to ReadSafe
- 462 Change ThreadSafety of Is30FpsThrottleEnabled from to ReadOnly
- 51 Add Is30FpsThrottleEnabled
IsPhysicsEnvironmentalThrottled
Type | Default | |
---|---|---|
bool | true |
Sets whether or not the physics environment should be throttled while running this test.
Thread safety | ReadSafe |
---|---|
Category | Physics |
Loaded/Saved | true |
History 8
- 640 Change CanSave of IsPhysicsEnvironmentalThrottled from false to true
- 640 Change Tags of IsPhysicsEnvironmentalThrottled from [Hidden, NotReplicated] to []
- 590 Change Tags of IsPhysicsEnvironmentalThrottled from [] to [Hidden, NotReplicated]
- 590 Change CanSave of IsPhysicsEnvironmentalThrottled from true to false
- 553 Change Default of IsPhysicsEnvironmentalThrottled from to true
- 486 Change ThreadSafety of IsPhysicsEnvironmentalThrottled from ReadOnly to ReadSafe
- 462 Change ThreadSafety of IsPhysicsEnvironmentalThrottled from to ReadOnly
- 51 Add IsPhysicsEnvironmentalThrottled
IsSleepAllowed
Type | Default | |
---|---|---|
bool | true |
Sets whether or not physics objects will be allowed to fall asleep while the test simulation is running.
Thread safety | ReadSafe |
---|---|
Category | Physics |
Loaded/Saved | true |
History 4
- 553 Change Default of IsSleepAllowed from to true
- 486 Change ThreadSafety of IsSleepAllowed from ReadOnly to ReadSafe
- 462 Change ThreadSafety of IsSleepAllowed from to ReadOnly
- 51 Add IsSleepAllowed
Message
Parameters (3) | Default | |
---|---|---|
text | string | |
source | Instance | Instance |
line | int | 0 |
Returns (1) | ||
null |
Prints Test message, followed by text to the output, in blue text.
Thread safety | Unsafe |
---|
NumberOfPlayers
Type | Default | |
---|---|---|
int | 0 |
The number of players expected in this test, if any.
Thread safety | ReadSafe |
---|---|
Category | Settings |
Loaded/Saved | true |
History 8
- 553 Change Default of NumberOfPlayers from to 0
- 486 Change ThreadSafety of NumberOfPlayers from ReadOnly to ReadSafe
- 462 Change ThreadSafety of NumberOfPlayers from to ReadOnly
- 95 Add NumberOfPlayers
- 94 Remove NumberOfPlayers
- 95 Add NumberOfPlayers
- 94 Remove NumberOfPlayers
- 95 Add NumberOfPlayers
Require
Parameters (4) | Default | |
---|---|---|
condition | bool | |
description | string | |
source | Instance | Instance |
line | int | 0 |
Returns (1) | ||
null |
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
, to the output
in red text.
Thread safety | Unsafe |
---|
Run
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Runs scripts which are parented to TestService.
Security | PluginSecurity |
---|---|
Thread safety | Unsafe |
ScopeTime
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Dictionary |
Thread safety | Unsafe |
---|
ServerCollectConditionalResult
Parameters (4) | |
---|---|
condition | bool |
text | string |
script | Instance |
line | int |
Fired when the server should collect a conditional test result.
Thread safety | Unsafe |
---|
History 6
- 462 Change ThreadSafety of ServerCollectConditionalResult from to Unsafe
- 95 Add ServerCollectConditionalResult
- 94 Remove ServerCollectConditionalResult
- 95 Add ServerCollectConditionalResult
- 94 Remove ServerCollectConditionalResult
- 95 Add ServerCollectConditionalResult
ServerCollectResult
Parameters (3) | |
---|---|
text | string |
script | Instance |
line | int |
Fired when the server should collect a test result.
Thread safety | Unsafe |
---|
History 6
- 462 Change ThreadSafety of ServerCollectResult from to Unsafe
- 95 Add ServerCollectResult
- 94 Remove ServerCollectResult
- 95 Add ServerCollectResult
- 94 Remove ServerCollectResult
- 95 Add ServerCollectResult
SimulateSecondsLag
Type | Default | |
---|---|---|
double | 0 |
Sets a specific amount of additional latency experienced by players during the test session.
Thread safety | ReadSafe |
---|---|
Category | Settings |
Loaded/Saved | true |
History 4
- 553 Change Default of SimulateSecondsLag from to 0
- 486 Change ThreadSafety of SimulateSecondsLag from ReadOnly to ReadSafe
- 462 Change ThreadSafety of SimulateSecondsLag from to ReadOnly
- 178 Add SimulateSecondsLag
TestCount
Type | Default | |
---|---|---|
int | 0 |
Measures how many test calls have been recorded in the test session.
Thread safety | ReadSafe |
---|---|
Category | Results |
Loaded/Saved | false/true |
Timeout
Type | Default | |
---|---|---|
double | 10 |
The maximum amount of time that tests are allowed to run for.
Thread safety | ReadSafe |
---|---|
Category | Settings |
Loaded/Saved | true |
Warn
Parameters (4) | Default | |
---|---|---|
condition | bool | |
description | string | |
source | Instance | Instance |
line | int | 0 |
Returns (1) | ||
null |
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.
Thread safety | Unsafe |
---|
WarnCount
Type | Default | |
---|---|---|
int | 0 |
Measures how many warning calls have been recorded in the test session.
Thread safety | ReadSafe |
---|---|
Category | Results |
Loaded/Saved | false/true |
isFeatureEnabled
Parameters (1) | ||
---|---|---|
name | string | |
Returns (1) | ||
bool |
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of isFeatureEnabled from to Unsafe
- 349 Add isFeatureEnabled
Removed members 4
DoCommand
Parameters (1) | ||
---|---|---|
name | string | |
Returns (1) | ||
void |
Security | LocalUserSecurity |
---|
GetCommandNames
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Array |
Security | LocalUserSecurity |
---|
History 2
- 214 Remove GetCommandNames
- 57 Add GetCommandNames
IsCommandChecked
Parameters (1) | ||
---|---|---|
name | string | |
Returns (1) | ||
bool |
Security | LocalUserSecurity |
---|
History 2
- 214 Remove IsCommandChecked
- 57 Add IsCommandChecked
IsCommandEnabled
Parameters (1) | ||
---|---|---|
name | string | |
Returns (1) | ||
bool |
Security | LocalUserSecurity |
---|
History 2
- 214 Remove IsCommandEnabled
- 57 Add IsCommandEnabled