MATLAB 帮助中心
本页采用了机器翻译。点击此处可查看最新英文版本。
类: slreq.ReqSet 命名空间: slreq
运行与需求集集相关的测试用例
自 R2022a 起
status = runTests(rs)
status = runTests(rs,Select=SelectValue)
您可以使用 runTests 运行 MATLAB® 单元测试、Simulink 测试和 Simulink® Design Verifier™ 可验证文件。
runTests
status = runTests(rs) 运行与需求集 rs 中的需求相关的测试。
status
rs
示例
status = runTests(rs,Select=SelectValue) 仅运行 SelectValue 指定的测试。
SelectValue
全部展开
slreq.ReqSet
需求集,指定为 slreq.ReqSet 对象。
"all"
"failed"
"unexecuted"
选择要运行的测试的选项,指定为:
"all" - 运行与需求集集中的需求相关的所有测试。
"failed" - 仅运行与需求集集中的需求相关的失败的测试。
"unexecuted" - 仅运行与需求集集中的需求相关的未执行的测试。
测试运行后,需求需求集集验证状态摘要,以包含以下字段的 MATLAB 结构体返回:
total
double
需求集集中包含验证链接的需求总数,以 double 形式返回。
passed
需求集通过与其相关测试的需求数量,以 double 形式返回。
failed
需求集未通过相关测试的需求数量,以 double 形式返回。
unexecuted
需求集集中未执行测试的需求数量,以 double 形式返回。
justified
需求集需要验证的需求数量,以 double 形式返回。
none
需求集集中没有指向验证对象的链接的需求数量,以 double 形式返回。
此示例显示如何运行与需求集集中的需求相关的测试。
打开 ShortestPath 工程。
ShortestPath
openProject("ShortestPath");
加载 shortest_path_func_reqs 和 shortest_path_tests_reqs 需求集。这些需求集集中的需求包含指向 graph_unit_tests.m 中的测试的链接。
shortest_path_func_reqs
shortest_path_tests_reqs
graph_unit_tests.m
funcReqs = slreq.load("shortest_path_func_reqs"); testReqs = slreq.load("shortest_path_tests_reqs");
运行与 shortest_path_func_reqs 需求集的需求相关的测试。
status = runTests(funcReqs)
Running graph_unit_tests .......... .. Done graph_unit_tests __________
status = struct with fields: total: 8 passed: 5 failed: 0 unexecuted: 0 justified: 0 none: 3
更新并获取 shortest_path_tests_reqs 需求集的验证状态,以查看是否运行了与该需求集的需求相关的任何测试。
updateVerificationStatus(testReqs); status = getVerificationStatus(testReqs)
status = struct with fields: total: 14 passed: 10 failed: 0 unexecuted: 3 justified: 0 none: 1
仅运行与需求集相关的未执行的测试。
status = runTests(testReqs,select="unexecuted")
Running graph_unit_tests ... Done graph_unit_tests __________
status = struct with fields: total: 14 passed: 13 failed: 0 unexecuted: 0 justified: 0 none: 1
在 R2022a 中推出
getVerificationStatus
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处