runTests
Class: slreq.ReqSet
Namespace: slreq
Description
You can use runTests
to run MATLAB® unit tests, Simulink tests, and Simulink®
Design Verifier™ verifiables.
Input Arguments
rs
— Requirement set
slreq.ReqSet
object
Requirement set, specified as an slreq.ReqSet
object.
SelectValue
— Option to select tests to run
"all"
(default) | "failed"
| "unexecuted"
Option to select tests to run, specified as:
"all"
— Run all tests linked to requirements in the requirement set."failed"
— Run only failed tests linked to requirements in the requirement set."unexecuted"
— Run only unexecuted tests linked to requirements in the requirement set.
Output Arguments
status
— Requirement set verification status summary
structure
Requirement set verification status summary for the requirement set after the tests are run, returned as a MATLAB structure containing these fields:
total
— Total number of requirements
double
Total number of requirements in the requirement set with verification links,
returned as a double
.
passed
— Number of requirements that passed
double
Number of requirements in the requirement set that passed the tests associated
with them, returned as a double
.
failed
— Number of requirements that failed
double
Number of requirements in the requirement set that failed the tests associated
with them, returned as a double
.
unexecuted
— Number of requirements with unexecuted tests
double
Number of requirements in the requirement set with unexecuted tests, returned
as a double
.
justified
— Number of requirements justified for verification
double
Number of requirements justified for verification in the requirement set,
returned as a double
.
none
— Number of requirements without links
double
Number of requirements without links to verification objects in the
requirement set, returned as a double
.
Examples
Run Tests Linked to Requirements
This example shows how to run tests linked to requirements in a requirement set.
Open the ShortestPath
project.
openProject("ShortestPath");
Load the shortest_path_func_reqs
and shortest_path_tests_reqs
requirement sets. Requirements in these requirement sets contain links to tests in graph_unit_tests.m
.
funcReqs = slreq.load("shortest_path_func_reqs"); testReqs = slreq.load("shortest_path_tests_reqs");
Run the tests linked to the requirements in the shortest_path_func_reqs
requirement set.
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
Update and get the verification status for the shortest_path_tests_reqs
requirement set to see if any tests linked to requirements in that requirement set were run.
updateVerificationStatus(testReqs); status = getVerificationStatus(testReqs)
status = struct with fields:
total: 14
passed: 10
failed: 0
unexecuted: 3
justified: 0
none: 1
Run only the unexecuted tests linked to the requirement set.
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
Version History
Introduced in R2022a
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)