Reference API Roblox

Engine API

Website

Related

Reference API Roblox

TestService

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

This class is a service. It is a singleton that may be acquired with GetService.
Tags: [Service]

Member index 47

HistoryMember
731AutoRuns: bool
486Description: string
731ErrorCount: int
731ExecuteWithStudioRun: bool
731Is30FpsThrottleEnabled: bool
731IsPhysicsEnvironmentalThrottled: bool
731IsSleepAllowed: bool
731NumberOfPlayers: int
731SimulateSecondsLag: double
731TestCount: int
731ThrottlePhysicsToRealtime: bool
731Timeout: double
731WarnCount: int
721CaptureScreenshotAsync(artifactName: string = , options: Dictionary = nil): Tuple
573Check(condition: bool, description: string, source: Instance = Instance, line: int = 0): null
573Checkpoint(text: string, source: Instance = Instance, line: int = 0): null
689ConvertSlimAcrToObj(acrFullFilePath: string, objFileName: string): string
687CreateAndSavePropertySet(source: Instance): string
687CreateExtraAssetsFileFromPropertySet(psetFileName: string): string
573Done(): null
573Error(description: string, source: Instance = Instance, line: int = 0): null
573Fail(description: string, source: Instance = Instance, line: int = 0): null
687FetchExtraAssets(extraAssetsFileName: string): string
732FetchTestControlsAsync(category: string): Tuple
728GetTestControlSchema(providerName: string): Dictionary
728GetTestControls(providerName: string): Dictionary
573Message(text: string, source: Instance = Instance, line: int = 0): null
712RegisterTest(testOptions: Dictionary): TestCase
731RegisterTestLegacy(testOptions: Dictionary): TestCase
732RequestValidationAsync(artifactType: string, artifactName: string, timeoutSeconds: double = 60): Tuple
573Require(condition: bool, description: string, source: Instance = Instance, line: int = 0): null
728ResetTestControl(providerName: string, controlName: string): null
731Run(): null
702RunAsync(): null
486ScopeTime(): Dictionary
728SetTestControl(providerName: string, controlName: string, value: Variant): null
709StartTestSession(): null
728StartVideoCaptureAsync(artifactName: string = , options: Dictionary = nil): Tuple
709StopTestSession(): null
728StopVideoCaptureAsync(): Tuple
708TakeSnapshot(snapshotname: string, source: Instance = Instance): null
687TranscodePropertySet(extraAssetsFileName: string, psetFileName: string): string
573Warn(condition: bool, description: string, source: Instance = Instance, line: int = 0): null
709getTestSessionProviderStats(providerName: string): Dictionary
462isFeatureEnabled(name: string): bool
462ServerCollectConditionalResult(condition: bool, text: string, script: Instance, line: int)
462ServerCollectResult(text: string, script: Instance, line: int)
inherited from Instance
731Archivable: bool
731Capabilities: SecurityCapabilities
731IsInSandbox: bool
731Name: string
731Parent: Instance
731PredictionMode: PredictionMode
731Sandboxed: bool
731UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
731children(): Instances
731clone(): Instance
731destroy(): null
731findFirstChild(name: string, recursive: bool = false): Instance
731getChildren(): Instances
731isDescendantOf(ancestor: Instance): bool
731remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
731childAdded(child: Instance)
inherited from Object
731ClassName: string
731className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
731isA(className: string): bool
647Changed(property: string)

Removed member index 5

HistoryMember
696CreatePropertySetDiff(sourceA: Instance, sourceB: Instance): string
214DoCommand(name: string): void
214GetCommandNames(): Array
214IsCommandChecked(name: string): bool
214IsCommandEnabled(name: string): bool

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.

MacroTest 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.

MacroTest 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.

MacroTest 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

MacroDescription
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 183

Members 47

AutoRuns

TypeDefault
booltrue

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

History 6

CaptureScreenshotAsync

Parameters (2)Default
artifactNamestring
optionsDictionarynil
Returns (1)
Tuple
This function yields. It will block the calling thread until completion.

History 1

Tags: [Yields]

Check

Parameters (4)Default
conditionbool
descriptionstring
sourceInstanceInstance
lineint0
Returns (1)
null

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.

History 4

Checkpoint

Parameters (3)Default
textstring
sourceInstanceInstance
lineint0
Returns (1)
null

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

History 4

ConvertSlimAcrToObj

Parameters (2)
acrFullFilePathstring
objFileNamestring
Returns (1)
string

History 1

CreateAndSavePropertySet

Parameters (1)
sourceInstance
Returns (1)
string

History 3

CreateExtraAssetsFileFromPropertySet

Parameters (1)
psetFileNamestring
Returns (1)
string

History 1

Description

TypeDefault
string

A description of the test being executed.

History 3

Done

Parameters (0)
No parameters.
Returns (1)
null

Prints Testing Done to the output in blue text.

History 3

Error

Parameters (3)Default
descriptionstring
sourceInstanceInstance
lineint0
Returns (1)
null

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

History 3

ErrorCount

TypeDefault
int0

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

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 6

Tags: [ReadOnly, NotReplicated]

ExecuteWithStudioRun

TypeDefault
boolfalse

When set to true, TestService will be executed when using the Run action in Roblox Studio.

Note that if the 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.

History 6

Fail

Parameters (3)Default
descriptionstring
sourceInstanceInstance
lineint0
Returns (1)
null

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.

History 3

FetchExtraAssets

Parameters (1)
extraAssetsFileNamestring
Returns (1)
string

History 1

FetchTestControlsAsync

Parameters (1)
categorystring
Returns (1)
Tuple
This function yields. It will block the calling thread until completion.

History 1

Tags: [Yields]

GetTestControlSchema

Parameters (1)
providerNamestring
Returns (1)
Dictionary

History 1

GetTestControls

Parameters (1)
providerNamestring
Returns (1)
Dictionary

History 1

Is30FpsThrottleEnabled

TypeDefault
booltrue

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

This property is deprecated. It exists only for backward compatibility, and should not be used for new work. ThrottlePhysicsToRealtime should be used instead.
This property is not replicated. Its interface does not cross the network boundary.

History 15

Tags: [NotReplicated, Deprecated]

IsPhysicsEnvironmentalThrottled

TypeDefault
booltrue

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

History 10

IsSleepAllowed

TypeDefault
booltrue

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

History 6

Message

Parameters (3)Default
textstring
sourceInstanceInstance
lineint0
Returns (1)
null

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

History 4

NumberOfPlayers

TypeDefault
int0

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

History 10

RegisterTest

Parameters (1)
testOptionsDictionary
Returns (1)
TestCase

History 1

RegisterTestLegacy

Parameters (1)
testOptionsDictionary
Returns (1)
TestCase

History 1

RequestValidationAsync

Parameters (3)Default
artifactTypestring
artifactNamestring
timeoutSecondsdouble60
Returns (1)
Tuple
This function yields. It will block the calling thread until completion.

History 2

Tags: [Yields]

Require

Parameters (4)Default
conditionbool
descriptionstring
sourceInstanceInstance
lineint0
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 in red text.

History 4

ResetTestControl

Parameters (2)
providerNamestring
controlNamestring
Returns (1)
null

History 1

Run

Parameters (0)
No parameters.
Returns (1)
null
This function is deprecated. It exists only for backward compatibility, and should not be used for new work. RunAsync should be used instead.
This function yields. It will block the calling thread until completion.

History 12

  • 731 Change PreferredDescriptor of Run from to RunAsync
  • 726 Change PreferredDescriptor of Run from RunAsync to
  • 702 Change Tags of Run from [Yields] to [Yields, Deprecated]
  • 702 Change PreferredDescriptor of Run from to RunAsync
  • 701 Change Tags of Run from [Yields, Deprecated] to [Yields]
  • 701 Change PreferredDescriptor of Run from RunAsync to
  • 702 Change Tags of Run from [Yields] to [Yields, Deprecated]
  • 702 Change PreferredDescriptor of Run from to RunAsync
  • 573 Change ReturnType of Run from void to null
  • 462 Change ThreadSafety of Run from to Unsafe
  • 151 Change Security of Run from LocalUserSecurity to PluginSecurity
  • 52 Add Run
Tags: [Yields, Deprecated]

RunAsync

Parameters (0)
No parameters.
Returns (1)
null

Runs scripts which are parented to TestService.

This function yields. It will block the calling thread until completion.

History 3

Tags: [Yields]

ScopeTime

Parameters (0)
No parameters.
Returns (1)
Dictionary

History 1

ServerCollectConditionalResult

Parameters (4)
conditionbool
textstring
scriptInstance
lineint

Fires when the server should collect a conditional test result.

History 6

ServerCollectResult

Parameters (3)
textstring
scriptInstance
lineint

Fires when the server should collect a test result.

History 6

SetTestControl

Parameters (3)
providerNamestring
controlNamestring
valueVariant
Returns (1)
null

History 1

SimulateSecondsLag

TypeDefault
double0

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

History 6

StartTestSession

Parameters (0)
No parameters.
Returns (1)
null

History 1

StartVideoCaptureAsync

Parameters (2)Default
artifactNamestring
optionsDictionarynil
Returns (1)
Tuple
This function yields. It will block the calling thread until completion.

History 1

Tags: [Yields]

StopTestSession

Parameters (0)
No parameters.
Returns (1)
null

History 1

StopVideoCaptureAsync

Parameters (0)
No parameters.
Returns (1)
Tuple
This function yields. It will block the calling thread until completion.

History 1

Tags: [Yields]

TakeSnapshot

Parameters (2)Default
snapshotnamestring
sourceInstanceInstance
Returns (1)
null

History 2

TestCount

TypeDefault
int0

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

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 6

Tags: [ReadOnly, NotReplicated]

ThrottlePhysicsToRealtime

TypeDefault
booltrue

Sets whether the test should be throttled to simulate time according to real world time or as fast as possible.

History 3

Timeout

TypeDefault
double10

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

History 6

TranscodePropertySet

Parameters (2)
extraAssetsFileNamestring
psetFileNamestring
Returns (1)
string

History 1

Warn

Parameters (4)Default
conditionbool
descriptionstring
sourceInstanceInstance
lineint0
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.

History 4

WarnCount

TypeDefault
int0

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

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 6

Tags: [ReadOnly, NotReplicated]

getTestSessionProviderStats

Parameters (1)
providerNamestring
Returns (1)
Dictionary

History 1

isFeatureEnabled

Parameters (1)
namestring
Returns (1)
bool

History 2

Removed members 5

CreatePropertySetDiff

Parameters (2)
sourceAInstance
sourceBInstance
Returns (1)
string

History 2

DoCommand

Parameters (1)
namestring
Returns (1)
void

History 2

GetCommandNames

Parameters (0)
No parameters.
Returns (1)
Array

History 2

IsCommandChecked

Parameters (1)
namestring
Returns (1)
bool

History 2

IsCommandEnabled

Parameters (1)
namestring
Returns (1)
bool

History 2

Settings