Integrating Results from an External Result file

In this example, you link a requirement to a test result file that is in Excel Format. The verification status in the Simulink Requirements Editor reflects the test results. The external results file is an Excel file called results.xlsx. The verification status in Simulink Requirements updates based on the values of the cells in the Excel sheet. A unique ID in the Test column identifies each result in the Status column. The Test and Status labels are contained in a header row.


Suppose you want to update the verification information for the counterSetsValue test case based on the Excel status log. Follow these steps to create and verify links to the result file:

  1. You start with opening the Requirements set counter_req.slreqx'.

  2. You create and register the Linktype using the API.

  3. You create the link.

  4. You view the Verification Status.

Section 1: Open the Requirements Set

Before creating links, open the requirements file containing the requirements.

reqSet ='counter_req.slreqx');

This will open the requirements set 'counter_req.slreqx'.

Section 2: Create and Register Custom Linktype

The domain registration needed for this example is written in 'linktype_myexcelresults.m'. The template file for domain registrations is available at: matlabroot/toolbox/slrequirements/linktype_examples/linktype_TEMPLATE.m. Take a look at the implementation of GetResultFcn in the domain registration file:

edit linktype_myexcelresults;

Register the custom linktype:

rmi register linktype_myexcelresults;
Warning: Link type "'linktype_myexcelresults'" is already registered 

If the command returns any warning, then you must unregister the file and follow the command again. Unregister the file by entering: rmi unregister linktype_myexcelresults

Section 3: Create the Link

Make the struct containing properties of the external test. Follow these steps to create the link: = 'counterSetsValue';
externalSource.artifact = 'results.xlsx';
externalSource.domain = 'linktype_myexcelresults';

Find the requirement related to the link by typing:

requirement = reqSet.find('Type', 'Requirement', 'SID', 2);

Create the link by entering:

link = slreq.createLink(requirement, externalSource);

This creates the link as test case counterSetsValue to the requirement 'SID'. In Requirements Editor, the link appears in the Links Confirmed by section.

Section 4: View the Verification Status

To update the verification status for the requirements set, type:


Fetch the verification status for the requirement:

status = reqSet.getVerificationStatus;

The Requirements Editor shows the verification status for entire requirements set that are passes or failed.

The verification status for the requirements for the counterSetsValue is fully verified. The Requirements Editor shows the overall verfication statuses for all the other requirements links associated with counter_req.slreqx.

reqSet ='counter_req.slreqx');

If unable to see the verification status, click on the Refresh button to see the verification status for the requirements in the Requirements Editor. The verification status shows that out of three tests, one test passed.

Clear the requirements once the simulation is completed.