View Test Results at the Command Line


After you run a test, the SystemTest™ software will automatically populate the MATLAB® workspace with a variable called stresults. This variable provides access to the test results object, which is useful for comparing the results of separate test runs and for postprocessing test results.

Accessing the Results Summary

You access the results using the stresults variable. To see an example, use the Fault Tolerant Fuel Control System model.

  1. To open the model in the SystemTest software, type the following at the MATLAB command line:

    systemtest demosystest_fuelctrl
  2. Run the test by clicking the Run button on the SystemTest toolbar.

  3. To view the results after the test runs, return to MATLAB and type:


The test results object looks like the following for the Fault Tolerant Fuel Control System example:

The summary shows the number of iterations that ran, the names of the test vectors included in the test, the saved results you specified in Save Results, the dataset array, and generated artifacts.

NumberOfIterations reflects how many iterations actually executed when the test ran. This will match what is reflected in the SystemTest software in the Main Test node of the Test Browser if all iterations ran. If any iterations stopped or errored out, this will show only the number that did execute.

TestVectorNames is a 1-by-N string cell array containing the test vector names. The values are an alphabetical list of test vector names.

SavedResultNames is a 1-by-N string cell array containing the test result names. The values are an alphabetical list of test result names.

ResultsDataSet is the dataset array storing the test vector and test result values for each iteration. See Accessing the dataset Array for information on accessing the test results data.

Artifacts provides links to SystemTest-generated documents, such as the test report. You can open the report by clicking the link. If your test includes a model coverage report, that would also be included here.

Note that in the example shown here, the Test Report was enabled before the test was run, so the link is displayed in the results. By default the report is not enabled. To see the link to the report in this example (or any test you run), enable the report before running the test. To enable the report, click on the test name in the Test Browser, then select the Generate report option on the Output Files tab of the Properties pane.

Accessing Properties of the Test Results Object

You can see a complete list of test results object properties before looking at the actual test results data. At the command line, type:


In the example using the Fault Tolerant Fuel Control System model, you see the following properties:

In addition to information that is also included in the summary, this includes derived results names, start time, stop time, tags, user data, and grouping information.

DerivedResultNames contains values if you created any derived results using the Test Results Viewer. In the previous example there are no derived results, so the value is {}. If there were derived results, this property would contain an alphabetical list of their names.

StartTime provides the time the test was started in the form of a MATLAB clock vector.

StopTime provides the time the test was stopped in the form of a MATLAB clock vector.

TestFile stores the full path and name of the test that generated the test results. If the test has been saved, the value will contain the full path and name of the test. If the test has not yet been saved, the value will show only the test name.

Tag displays any string you specified using the set function. It is a descriptive string used for labeling purposes. By default, this property is empty.

UserData is a property for storing user data. It is used to store any arbitrary MATLAB data you would like to associate with the test results object. By default, this property is empty.

Grouping displays information about grouping of the test vectors. If you assign any test vectors to groups (using the Grouping tab on the Test Vectors pane), then the groups are listed here.

Accessing the dataset Array

The ResultsDataSet property contains the test results data in the form of a dataset array. This is what you set up using the Saved Results node in the Test Browser. See Save Test Results for more information on setting up saved results.

To access the test results data:

  1. After running a test, use the stresults variable to view the test results object summary, as described in the previous section.

  2. To access the ResultsDataSet property, type:



    get(stresults, 'ResultsDataSet')

This returns the test results data in the form of a dataset array.

In the Fault Tolerant Fuel Control System example, a portion of the test results data looks like this:

In the dataset array, each row represents a test iteration, labeled using the convention of ['I' + Iteration_Number]. The previous example shows the first 10 iterations. Test vector values are listed first, in alphabetical order, as shown, followed by test results, listed in alphabetical order, as shown in the following figure.

Notice that this example shows the test vectors list for the last two iterations (I95 and I96), and the beginning of the display of the test result values. There are five results, shown in alphabetical order. The display wraps in MATLAB, so the fifth result is shown after all the iterations for the first four.

In this example, the value for AvgAirFuel is 14.4466 for the first iteration, 11.8858 for the second iteration, etc.

Was this topic helpful?