学习
引擎类
TestService
服务

*此内容使用人工智能(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")
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 是我们在美国及其他国家或地区的注册与未注册商标。