link test cases to requirements -凯发k8网页登录

main content

link test cases to requirements

if you have simulink® test™ and requirements toolbox™, you can link your requirements to test cases in the test manager. linking requirements to tests allows you to verify that the implementation of the requirement behaves as expected. you can use the requirement verification status to track verification progress. for more information, see .

link a test case to a requirement example

this example shows how to link a test case to a requirement associated with a controller model of an automobile cruise control system. after you run the tests, you include the results in the requirements editor.

to link a requirement to a test case, open the project, cruiserequirementsexample. then, open the crs_controller model.

openproject("cruiserequirementsexample");
open_system("models/crs_controller");

load the test files that contain the tests you want to link.

  1. from the model, open the test manager. in the apps tab, click simulink test. in the tests tab, click simulink test manager.

  2. in the test manager, open the driverswrequest_tests.mldatx and crs_controller_tests.mldatx test files. in the file section, click open. load the test files in the cruiserequirementsexample\tests folder.

the test files contain the test cases for several of the requirements in the crs_controller model. most of these test cases already link to requirements.

in this example, you link the increment button hold test to a requirement. in the left pane, click driverswrequest_tests > unit test for driverswrequest > increment button hold. in the model, open the requirements editor. in the apps tab, in the apps section, click requirements editor. click show requirements. the requirements editor displays two requirement sets, crs_req_func_spec, and crs_req_safety_spec.

in this example, you do not test the requirements in crs_req_safety_spec, and you must load another requirement set to load the tested requirements. to close the crs_req_safety_spec requirement set, select crs_req_safety_spec and, in the file section, click close. in the file section, click open. in cruiserequirementsexample\documents, open the file crs_req.slreqx. the requirements editor updates the loaded requirements.

link the requirement to the test case. expand the crs_req_func_spec requirement set and expand the requirement with the index 1. select the requirement with the index 1.3. in the links section, click add link > link from selected test case. the link to the test case appears in the right pane, under links.

you can view verification information for other requirements by selecting each requirement.

run the linked tests. in the test manager, select the top node in the test hierarchy in the test browser pane that corresponds to each test file and click run. the results and artifacts pane shows that 7 tests passed and 1 test failed in the driverswrequest_tests test file, and that 4 of the tests passed in the crs_controller_tests test file. expand the results of each test run, test file, and test suite. in the test results for driverswrequest_tests, the cancel button test failed.

to view the verification status associated with the requirements linked to the tests in the requirements editor, in the view section, click columns > verification status. some requirements do not have tests, and some requirements are fully verified. the bar in the verified column shows the proportion of child requirements that have links to verification. the color of the display indicates the proportion of tests that have passed, failed, or not run.

in this example, the verification status shows that the test that you linked to the requirement 1.3 passed, and the test linked to cancel switch detection failed. some requirements are partially verified because the child requirements are not yet verified, such as requirement 1.8. to view a summary of details about the child requirements, point to the verification status bar of the parent requirement. other requirements are unverified because they are not linked to a test case.

related topics

网站地图