# StudioTestService

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable, Not replicated, Service
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/StudioTestService/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/StudioTestService

Service allowing plugins to automate and customize Test and Run mode testing.

## Properties

### EditModeActive

```luau
StudioTestService.EditModeActive: boolean = true
```

- Tags: Plugin security

Plugin-facing. Indicates whether the session is the idle edit [`DataModel`](https://rapi.sleaze.dev/classes/DataModel.md) with no Studio test session running.

## Methods

### AddPlayers

```luau
StudioTestService:AddPlayers(numPlayers: number)
```

Adds additional simulated clients to the running multiplayer test session.

Parameters:

- `numPlayers`: The number of additional client DataModels to add. Must be between 1 and 8.

### CanLeaveTest

```luau
StudioTestService:CanLeaveTest(): boolean
```

Returns whether the calling client DataModel can disconnect from the test.

Returns: `true` if the client can leave, `false` otherwise.

### EndTest

```luau
StudioTestService:EndTest(value: any)
```

Ends the current Studio test session from the server DataModel.

Parameters:

- `value`: Value returned to the calling [`StudioTestService:ExecutePlayModeAsync()`](https://rapi.sleaze.dev/classes/StudioTestService.md) or [`StudioTestService:ExecuteRunModeAsync()`](https://rapi.sleaze.dev/classes/StudioTestService.md) method.

### ExecuteMultiplayerTestAsync

```luau
StudioTestService:ExecuteMultiplayerTestAsync(numPlayers: number, args: any): any
```

- Tags: Yields, Plugin security

Launches a multiplayer test session and yields until it completes.

Parameters:

- `numPlayers`: The number of client DataModels to create. Must be between 1 and 8.
- `args`: An optional Roblox-serializable value forwarded to scripts inside the test session.

Returns: The value passed to [`StudioTestService:EndTest()`](https://rapi.sleaze.dev/classes/StudioTestService.md).

### ExecutePlayModeAsync

```luau
StudioTestService:ExecutePlayModeAsync(args: any): any
```

- Tags: Yields, Plugin security

Starts a solo Test session and yields until it ends.

Parameters:

- `args`: Argument passed to the test session, or `nil`.

Returns: Value passed from [`StudioTestService:EndTest()`](https://rapi.sleaze.dev/classes/StudioTestService.md), or `nil`.

### ExecuteRunModeAsync

```luau
StudioTestService:ExecuteRunModeAsync(args: any): any
```

- Tags: Yields, Plugin security

Starts a Run test session and yields until it ends.

Parameters:

- `args`: Argument passed to the test session, or `nil`.

Returns: Value passed from [`StudioTestService:EndTest()`](https://rapi.sleaze.dev/classes/StudioTestService.md), or `nil`.

### GetTestArgs

```luau
StudioTestService:GetTestArgs(): any
```

Returns the argument passed to the method that started the current test session.

Returns: Arguments passed to the test, or `nil`.

### LeaveTest

```luau
StudioTestService:LeaveTest()
```

Disconnects the calling client from the active multiplayer test.

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
