學習
引擎類別
TestService
服務

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡


概要
方法
Check(condition: boolean,description: string,source: Instance,line: number):()
Checkpoint(text: string,source: Instance,line: number):()
Done():()
Error(description: string,source: Instance,line: number):()
Fail(description: string,source: Instance,line: number):()
Message(text: string,source: Instance,line: number):()
RegisterTest(testOptions: Dictionary):TestCase
Require(condition: boolean,description: string,source: Instance,line: number):()
Run():()
已棄用
TakeSnapshot(snapshotname: string,source: Instance):()
Warn(condition: boolean,description: string,source: Instance,line: number):()
繼承成員

API 參考
屬性
AutoRuns
平行讀取
TestService.AutoRuns:boolean

Description
平行讀取
TestService.Description:string

ErrorCount
唯讀
未複製
平行讀取
TestService.ErrorCount:number

ExecuteWithStudioRun
平行讀取
TestService.ExecuteWithStudioRun:boolean

Is30FpsThrottleEnabled
已棄用

IsPhysicsEnvironmentalThrottled
平行讀取
TestService.IsPhysicsEnvironmentalThrottled:boolean

IsSleepAllowed
平行讀取
TestService.IsSleepAllowed:boolean

NumberOfPlayers
平行讀取
TestService.NumberOfPlayers:number

SimulateSecondsLag
平行讀取
TestService.SimulateSecondsLag:number

TestCount
唯讀
未複製
平行讀取
TestService.TestCount:number

ThrottlePhysicsToRealtime
平行讀取
TestService.ThrottlePhysicsToRealtime:boolean

Timeout
平行讀取
TestService.Timeout:number

WarnCount
唯讀
未複製
平行讀取
TestService.WarnCount:number

方法
Check
TestService:Check(
condition:boolean, description:string, source:Instance, line:number
):()
參數
condition:boolean
description:string
source:Instance
預設值:"nil"
line:number
預設值:0
返回
()
範例程式碼
測試服務:檢查
local TestService = game:GetService("TestService")
TestService:Check(false, "example")

Checkpoint
TestService:Checkpoint(
text:string, source:Instance, line:number
):()
參數
text:string
source:Instance
預設值:"nil"
line:number
預設值:0
返回
()
範例程式碼
測試服務:檢查點
local TestService = game:GetService("TestService")
TestService:Checkpoint("範例")

Done
TestService:Done():()
返回
()
範例程式碼
測試服務:完成
local TestService = game:GetService("TestService")
TestService:Done()

Error
TestService:Error(
description:string, source:Instance, line:number
):()
參數
description:string
source:Instance
預設值:"nil"
line:number
預設值:0
返回
()
範例程式碼
測試服務:錯誤
local TestService = game:GetService("TestService")
TestService:Error("這是一個錯誤")

Fail
TestService:Fail(
description:string, source:Instance, line:number
):()
參數
description:string
source:Instance
預設值:"nil"
line:number
預設值:0
返回
()

isFeatureEnabled
TestService:isFeatureEnabled(name:string):boolean
參數
name:string
返回

Message
TestService:Message(
text:string, source:Instance, line:number
):()
參數
text:string
source:Instance
預設值:"nil"
line:number
預設值:0
返回
()
範例程式碼
測試服務:訊息
local TestService = game:GetService("TestService")
TestService:Message("範例")

RegisterTest
TestService:RegisterTest(testOptions:Dictionary):TestCase
參數
testOptions:Dictionary
返回
TestCase

Require
TestService:Require(
condition:boolean, description:string, source:Instance, line:number
):()
參數
condition:boolean
description:string
source:Instance
預設值:"nil"
line:number
預設值:0
返回
()
範例程式碼
測試服務:要求
local TestService = game:GetService("TestService")
TestService:Require(false, "example")

Run
已棄用

RunAsync
暫停
外掛程式安全性
TestService:RunAsync():()
返回
()

ScopeTime
TestService:ScopeTime():Dictionary

TakeSnapshot
TestService:TakeSnapshot(
snapshotname:string, source:Instance
):()
參數
snapshotname:string
source:Instance
預設值:"nil"
返回
()

Warn
TestService:Warn(
condition:boolean, description:string, source:Instance, line:number
):()
參數
condition:boolean
description:string
source:Instance
預設值:"nil"
line:number
預設值:0
返回
()
範例程式碼
測試服務:警告
local TestService = game:GetService("TestService")
-- This will print a warning to the output
TestService:Warn(false, "這個動作無效")

活動
ServerCollectConditionalResult
TestService.ServerCollectConditionalResult(
condition:boolean, text:string, script:Instance, line:number
參數
condition:boolean
text:string
script:Instance
line:number

ServerCollectResult
TestService.ServerCollectResult(
text:string, script:Instance, line:number
參數
text:string
script:Instance
line:number

©2026 Roblox Corporation、Roblox、Roblox 標誌及 Powering Imagination 是我們在美國及其他國家地區的部分註冊與未註冊商標。