Main Content

Integrating Results from an External Result File

In this example, you link a requirement to a result file in Excel® Format. The verification status in the Requirements Editor reflects the test results. This example performs the steps described in Linking to a Result File. This example uses a requirement set file named counter_req and a test results file named results.xlsx. This file contains a test case named counterSetsValue.

Register the Custom Document Interface

Before creating the links, you need to register the custom document interface. Open the requirements file counter_req.slreqx in the Requirements Editor.

reqSet ='counter_req.slreqx');


Register the custom document interface that is specific to the external results file, custom_myexcelresults.m.

rmi register custom_myexcelresults

The custom logic in the GetResultFcn function locates the result file that corresponds to the test case and fetches the results from that result file. If the register command returns any warning, then you must unregister the file and run the command again. To unregister the file, enter rmi unregister custom_myexcelresults.

Create the Link

Make the struct containing properties of the external result. = 'counterSetsValue';
externalSource.artifact = 'results.xlsx';
externalSource.domain = 'custom_myexcelresults';

The requirement related to the link has its SID set to 4. Find the requirement related to the link.

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

Create the link.

link = slreq.createLink(requirement, externalSource);

This command creates the link between the test case counterSetsValue and the requirement with the SID of 4. In Requirements Editor, the link appears in the right pane under Links.

Note: In order to avoid stale results, make sure that the timestamp of result file is latest than the timestamp of link creation. Open the result file, make a dummy change in the file and save it again to get the latest timestamp.

View the Verification Status

To view the verification status, you need to first update the verification status for the requirement set. At the MATLAB® command prompt, type:


To see the verification status column in the Requirements Editor, select showColumns_16.png Columns > Verification Status. After the update, fetch the verification status for the requirement:

status = reqSet.getVerificationStatus
status = struct with fields:
        failed: 0
     justified: 0
          none: 2
        passed: 1
         total: 3
    unexecuted: 0

Open the Requirements Editor to see the verification status:

reqSet ='counter_req.slreqx');

The Requirements Editor shows the verification status for each requirement in the requirement set.

The verification status for requirements for the counterSetsValue is fully verified.

The verification status shows that out of three tests, one test passed. Click refresh_16.png Refresh to see the verification status for the requirements in the Requirements Editor.

Unregister the custom document interface.

rmi unregister custom_myexcelresults

Related Topics