Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

评估、准则和验证

逻辑和时间验证,数据比较,值和时间容差,专业结果处理

功能测试包括评估仿真行为以及将仿真数据与预期结果进行比较。您可以通过以下方式评估仿真行为:

  • 在测试用例中使用时间和逻辑评估。

  • Test AssessmentTest Sequence 模块中包含 verify 语句以及其他运算符。使用 Test Sequence 模块指定一系列步骤来仿真在测组件或在测系统。使用 Test Assessment 模块来评估在测组件或在测系统的行为。

  • 使用 Model Verification 库中的模块。

您可以通过以下方式评估仿真数据:

  • 将测试输出与基线数据进行比较,或使用等效性准则比较两个仿真的输出。

  • C

  • 比较仿真数据与基线数据或比较两个仿真时使用值或时间容差。可用的容差类型包括相对容差、绝对容差、超前容差和滞后容差。超前容差和滞后容差对于数据时序不同的比较(例如不同求解器之间的比较)或者桌面上运行的模型与目标上运行的代码之间的比较非常有用。

  • 使用自定义准则脚本处理仿真数据。

有关不同验证方法的概述,请参阅Assess Simulation and Compare Output Data

模块

Observer ReferenceCreate and contain an Observer model
Observer PortWirelessly link signals to use with verification
Test SequenceCreate simulation testing scenarios, function calls, and assessments
Test AssessmentAssess and verify behavior of system under test
Sequence ViewerDisplay messages, events, states, transitions, and functions between blocks during simulation
AssertionCheck whether signal is zero

sltest.testmanager.AssessmentLogical or temporal assessment object (自 R2022a 起)
sltest.testmanager.AssessmentSymbolSymbol used in assessment (自 R2022a 起)
sltest.testmanager.TestCaseCreate or modify test case

工具

测试管理器Model and code testing in different execution environments, manage test suites, and analyze and report results

语法运算符

全部展开

verifyAssess logical expression and automatically log result
assertEvaluate logical expression and stop simulation if false
etElapsed time of test step
tElapsed time of simulation
afterElapsed time since beginning of test step
beforeElapsed time until specified time in test step
durationElapsed time since condition is true
hasChangedDetect data change in test step
hasChangedFromDetect data change from specified value in test step
hasChangedToDetect data change to specified value in test step
squareSquare wave test signal
sawtoothSawtooth wave test signal
triangleTriangle wave test signal
rampReturn input value for test signal generation
heavisideHeaviside step test signal
latchSave value of an expression

主题