rojo/.cursor/rules/roblox/reference/engine/classes/TestService.yaml
2026-02-02 12:08:47 -06:00

842 lines
21 KiB
YAML

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: TestService
type: class
memory_category: Instances
summary: |
A service used by Roblox to run controlled tests of the engine. It is
available for developers to use, to a limited degree.
description: |
`TestService` is a service used by Roblox internally to run analytical tests
on the engine.
Scripts that are executed inside of `TestService` (via
`Class.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 `Class.TestService:Check()` function.
<table size="small">
<thead>
<tr>
<th>Macro</th>
<th>Test Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>RBX_CHECK(cond)</code></td>
<td><code>cond == true</code></td>
</tr>
<tr>
<td><code>RBX_CHECK_MESSAGE(cond, failMsg)</code></td>
<td><code>cond == true</code></td>
</tr>
<tr>
<td><code>RBX_CHECK_THROW(CODE)</code></td>
<td><code>pcall(function() CODE end) == false</code></td>
</tr>
<tr>
<td><code>RBX_CHECK_NO_THROW(CODE)</code></td>
<td><code>pcall(function() CODE end) == true</code></td>
</tr>
<tr>
<td><code>RBX_CHECK_EQUAL(a, b)</code></td>
<td><code>a == b</code></td>
</tr>
<tr>
<td><code>RBX_CHECK_NE(a, b)</code></td>
<td><code>a ~= b</code></td>
</tr>
<tr>
<td><code>RBX_CHECK_GE(a, b)</code></td>
<td><code>a &gt;= b</code></td>
</tr>
<tr>
<td><code>RBX_CHECK_LE(a, b)</code></td>
<td><code>a &lt;= b</code></td>
</tr>
<tr>
<td><code>RBX_CHECK_GT(a, b)</code></td>
<td><code>a &gt; b</code></td>
</tr>
<tr>
<td><code>RBX_CHECK_LT(a, b)</code></td>
<td><code>a &lt; b</code></td>
</tr>
</tbody>
</table>
#### RBX_REQUIRE
This macro does tests with calls to the `Class.TestService:Require()`
function.
<table size="small">
<thead>
<tr>
<th>Macro</th>
<th>Test Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>RBX_REQUIRE(cond)</code></td>
<td><code>cond == true</code></td>
</tr>
<tr>
<td><code>RBX_REQUIRE_MESSAGE(cond, failMsg)</code></td>
<td><code>cond == true</code></td>
</tr>
<tr>
<td><code>RBX_REQUIRE_THROW(CODE)</code></td>
<td><code>pcall(function() CODE end) == false</code></td>
</tr>
<tr>
<td><code>RBX_REQUIRE_NO_THROW(CODE)</code></td>
<td><code>pcall(function() CODE end) == true</code></td>
</tr>
<tr>
<td><code>RBX_REQUIRE_EQUAL(a, b)</code></td>
<td><code>a == b</code></td>
</tr>
<tr>
<td><code>RBX_REQUIRE_NE(a, b)</code></td>
<td><code>a ~= b</code></td>
</tr>
<tr>
<td><code>RBX_REQUIRE_GE(a, b)</code></td>
<td><code>a &gt;= b</code></td>
</tr>
<tr>
<td><code>RBX_REQUIRE_LE(a, b)</code></td>
<td><code>a &lt;= b</code></td>
</tr>
<tr>
<td><code>RBX_REQUIRE_GT(a, b)</code></td>
<td><code>a &gt; b</code></td>
</tr>
<tr>
<td><code>RBX_REQUIRE_LT(a, b)</code></td>
<td><code>a &lt; b</code></td>
</tr>
</tbody>
</table>
#### RBX_WARN
This macro does tests with calls to the `Class.TestService:Warn()` function.
<table size="small">
<thead>
<tr>
<th>Macro</th>
<th>Test Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>RBX_WARN(cond)</code></td>
<td><code>cond == true</code></td>
</tr>
<tr>
<td><code>RBX_WARN_MESSAGE(cond, failMsg)</code></td>
<td><code>cond == true</code></td>
</tr>
<tr>
<td><code>RBX_WARN_THROW(CODE)</code></td>
<td><code>pcall(function() CODE end) == false</code></td>
</tr>
<tr>
<td><code>RBX_WARN_NO_THROW(CODE)</code></td>
<td><code>pcall(function() CODE end) == true</code></td>
</tr>
<tr>
<td><code>RBX_WARN_EQUAL(a, b)</code></td>
<td><code>a == b</code></td>
</tr>
<tr>
<td><code>RBX_WARN_NE(a, b)</code></td>
<td><code>a ~= b</code></td>
</tr>
<tr>
<td><code>RBX_WARN_GE(a, b)</code></td>
<td><code>a &gt;= b</code></td>
</tr>
<tr>
<td><code>RBX_WARN_LE(a, b)</code></td>
<td><code>a &lt;= b</code></td>
</tr>
<tr>
<td><code>RBX_WARN_GT(a, b)</code></td>
<td><code>a &gt; b</code></td>
</tr>
<tr>
<td><code>RBX_WARN_LT(a, b)</code></td>
<td><code>a &lt; b</code></td>
</tr>
</tbody>
</table>
#### Additional Macros
<table size="small">
<thead>
<tr>
<th>Macro</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>RBX_ERROR(msg)</code></td>
<td>Directly calls the <code>Class.TestService:Error()</code> function.</td>
</tr>
<tr>
<td><code>RBX_FAIL(msg)</code></td>
<td>Directly calls the <code>Class.TestService:Fail()</code> function.</td>
</tr>
<tr>
<td><code>RBX_MESSAGE(msg)</code></td>
<td>Directly calls the <code>Class.TestService:Message()</code> function.</td>
</tr>
</tbody>
</table>
code_samples: []
inherits:
- Instance
descendants: []
tags:
- Service
deprecation_message: ''
properties:
- name: TestService.AutoRuns
summary: |
If set to `true`, the game will start running when the service's
`Class.TestService:RunAsync()` method is called.
description: |
If set to `true`, the game will start running when the service's
`Class.TestService:RunAsync()` method is called.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Physics
serialization:
can_load: true
can_save: true
capabilities: []
- name: TestService.Description
summary: |
A description of the test being executed.
description: |
A description of the test being executed.
code_samples: []
type: string
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities: []
- name: TestService.ErrorCount
summary: |
Measures how many errors have been recorded in the test session.
description: |
Measures how many errors have been recorded in the test session.
code_samples: []
type: int
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Results
serialization:
can_load: false
can_save: true
capabilities: []
- name: TestService.ExecuteWithStudioRun
summary: |
When set to `true`, `TestService` will be executed when using the **Run**
action in Roblox Studio.
description: |
When set to `true`, `TestService` will be executed when using the **Run**
action in Roblox Studio.
Note that if the `Class.TestService.NumberOfPlayers|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) or else your computer's CPU will get
overloaded.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Settings
serialization:
can_load: true
can_save: true
capabilities: []
- name: TestService.Is30FpsThrottleEnabled
summary: |
Sets whether or not the physics engine should be throttled to 30 FPS while
the test is being ran.
description: |
Sets whether or not the physics engine should be throttled to 30 FPS while
the test is being ran.
code_samples: []
type: boolean
tags:
- NotReplicated
- Deprecated
deprecation_message: |
This has been deprecated and directly renamed to
`Class.TestService.ThrottlePhysicsToRealtime|ThrottlePhysicsToRealtime` to
better reflect its practical use.
security:
read: None
write: None
thread_safety: ReadSafe
category: Physics
serialization:
can_load: true
can_save: false
capabilities: []
- name: TestService.IsPhysicsEnvironmentalThrottled
summary: |
Sets whether or not the physics environment should be throttled while
running this test.
description: |
Sets whether or not the physics environment should be throttled while
running this test.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Physics
serialization:
can_load: true
can_save: true
capabilities: []
- name: TestService.IsSleepAllowed
summary: |
Sets whether or not physics objects will be allowed to fall asleep while
the test simulation is running.
description: |
Sets whether or not physics objects will be allowed to fall asleep while
the test simulation is running.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Physics
serialization:
can_load: true
can_save: true
capabilities: []
- name: TestService.NumberOfPlayers
summary: |
The number of players expected in this test, if any.
description: |
The number of players expected in this test, if any.
code_samples: []
type: int
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Settings
serialization:
can_load: true
can_save: true
capabilities: []
- name: TestService.SimulateSecondsLag
summary: |
Sets a specific amount of additional latency experienced by players during
the test session.
description: |
Sets a specific amount of additional latency experienced by players during
the test session.
code_samples: []
type: double
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Settings
serialization:
can_load: true
can_save: true
capabilities: []
- name: TestService.TestCount
summary: |
Measures how many test calls have been recorded in the test session.
description: |
Measures how many test calls have been recorded in the test session.
code_samples: []
type: int
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Results
serialization:
can_load: false
can_save: true
capabilities: []
- name: TestService.ThrottlePhysicsToRealtime
summary: |
Sets whether the test should be throttled to simulate time according to
real world time or as fast as possible.
description: |
Sets whether the test should be throttled to simulate time according to
real world time or as fast as possible.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Physics
serialization:
can_load: true
can_save: true
capabilities: []
- name: TestService.Timeout
summary: |
The maximum amount of time that tests are allowed to run for.
description: |
The maximum amount of time that tests are allowed to run for.
code_samples: []
type: double
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Settings
serialization:
can_load: true
can_save: true
capabilities: []
- name: TestService.WarnCount
summary: |
Measures how many warning calls have been recorded in the test session.
description: |
Measures how many warning calls have been recorded in the test session.
code_samples: []
type: int
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Results
serialization:
can_load: false
can_save: true
capabilities: []
methods:
- name: TestService:Check
summary: |
Prints result of a condition to the output.
description: |
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.
code_samples: []
parameters:
- name: condition
type: boolean
default:
summary: ''
- name: description
type: string
default:
summary: ''
- name: source
type: Instance
default: nil
summary: ''
- name: line
type: int
default: 0
summary: ''
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: TestService:Checkpoint
summary: |
Prints `Test checkpoint:` followed by a string to the output in blue text.
description: |
Prints `Test checkpoint:` followed by `text` to the output in blue text.
code_samples: []
parameters:
- name: text
type: string
default:
summary: ''
- name: source
type: Instance
default: nil
summary: ''
- name: line
type: int
default: 0
summary: ''
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: TestService:Done
summary: |
Prints `Testing Done` to the output in blue text.
description: |
Prints `Testing Done` to the output in blue text.
code_samples: []
parameters: []
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: TestService:Error
summary: |
Prints a red error message to the output, prefixed by `TestService: `.
description: |
Prints a red error message (`description`) to the output, prefixed by
`TestService: `.
code_samples: []
parameters:
- name: description
type: string
default:
summary: ''
- name: source
type: Instance
default: nil
summary: ''
- name: line
type: int
default: 0
summary: ''
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: TestService:Fail
summary: |
Indicates a fatal error in a `TestService` run.
description: |
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.
code_samples: []
parameters:
- name: description
type: string
default:
summary: ''
- name: source
type: Instance
default: nil
summary: ''
- name: line
type: int
default: 0
summary: ''
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: TestService:isFeatureEnabled
summary: ''
description: ''
code_samples: []
parameters:
- name: name
type: string
default:
summary: ''
returns:
- type: boolean
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: TestService:Message
summary: |
Prints `TestService:` followed by a string to the output in blue text.
description: |
Prints `TestService:` followed by `text` to the output in blue text.
code_samples: []
parameters:
- name: text
type: string
default:
summary: ''
- name: source
type: Instance
default: nil
summary: ''
- name: line
type: int
default: 0
summary: ''
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: TestService:Require
summary: |
Prints whether a condition is true along with a description string.
description: |
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.
code_samples: []
parameters:
- name: condition
type: boolean
default:
summary: ''
- name: description
type: string
default:
summary: ''
- name: source
type: Instance
default: nil
summary: ''
- name: line
type: int
default: 0
summary: ''
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: TestService:RunAsync
summary: |
Runs scripts which are parented to `TestService`.
description: |
Runs scripts which are parented to `TestService`.
code_samples: []
parameters: []
returns:
- type: ()
summary: ''
tags:
- Yields
deprecation_message: ''
security: PluginSecurity
thread_safety: Unsafe
capabilities: []
- name: TestService:Run
summary: |
Runs scripts which are parented to `TestService`.
description: ''
code_samples: []
parameters: []
returns:
- type: ()
summary: ''
tags:
- Yields
- Deprecated
deprecation_message: ''
security: PluginSecurity
thread_safety: Unsafe
capabilities: []
- name: TestService:ScopeTime
summary: ''
description: ''
code_samples: []
parameters: []
returns:
- type: Dictionary
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: TestService:TakeSnapshot
summary: ''
description: ''
code_samples: []
parameters:
- name: snapshotname
type: string
default:
summary: ''
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- InternalTest
- name: TestService:Warn
summary: |
Prints if a condition is `true`, otherwise prints a warning.
description: |
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.
code_samples: []
parameters:
- name: condition
type: boolean
default:
summary: ''
- name: description
type: string
default:
summary: ''
- name: source
type: Instance
default: nil
summary: ''
- name: line
type: int
default: 0
summary: ''
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
events:
- name: TestService.ServerCollectConditionalResult
summary: |
Fires when the server should collect a conditional test result.
description: |
Fires when the server should collect a conditional test result.
code_samples: []
parameters:
- name: condition
type: boolean
default:
summary: ''
- name: text
type: string
default:
summary: ''
- name: script
type: Instance
default:
summary: ''
- name: line
type: int
default:
summary: ''
tags: []
deprecation_message: ''
security: None
capabilities: []
- name: TestService.ServerCollectResult
summary: |
Fires when the server should collect a test result.
description: |
Fires when the server should collect a test result.
code_samples: []
parameters:
- name: text
type: string
default:
summary: ''
- name: script
type: Instance
default:
summary: ''
- name: line
type: int
default:
summary: ''
tags: []
deprecation_message: ''
security: None
capabilities: []
callbacks: []