Main Content

slreportgen.report.TestSequence class

Package: slreportgen.report

Test Sequence block reporter

Description

Use an object of the slreportgen.report.TestSequence class to report on a Simulink® Test Sequence block. Using a Test Sequence block in a Simulink model requires Simulink Test™.

By default, a TestSequence reporter generates:

  • Property tables for all of the symbols — input, output, local, constant, parameter, and data store memory

  • A nested list for the step hierarchy

  • Details for each step including the step description, When condition, action statements, and a table of transition conditions and next steps

If the Test Sequence block uses scenarios, the TestSequence reporter includes the scenario parameter in the parameters table and a list for each scenario in the step hierarchy. In the report, scenarios are identified by the scenario icon. The active scenario is also identified by the word Active followed by the active scenario icon. For example:

Scenario 2 (Active)

The reporter adds a note to the report when the active scenario is controlled in the workspace. In this case, the active scenario is not identified in the report.

Use the TestSequence reporter properties to filter the content and customize the content formatting.

Note

To use an slreportgen.report.TestSequence reporter in a report, you must create the report using the slreportgen.report.Report class or subclass.

The slreportgen.report.TestSequence class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

reporter = slreportgen.report.TestSequence() creates an empty TestSequence reporter object based on the default template. You must specify a Test Sequence block to report by setting the Object property. Use other properties to specify report options.

example

reporter = slreportgen.report.TestSequence(testSeqObject) creates a TestSequence reporter and sets the Object property to the specified Test Sequence block.

reporter = slreportgen.report.TestSequence(Name,Value) sets the reporter properties using name-value pairs. You can specify multiple name-value pair arguments in any order. Enclose each property name in single or double quotes.

Properties

expand all

Test Sequence block to report, specified as one of these types of values:

Whether to include symbols in the report, specified as true or false. If IncludeSymbols is true, the report includes property tables for the symbols. In the input and output symbol property tables, the symbols are sorted by the port number. In the local, constant, parameter, and data store memory tables, the symbols are sorted by the symbol name.

If the model was compiled before report generation, the values in the property tables are the values after compilation. Otherwise, the property values are the values before compilation and a note at the end of the Symbols section states that the model was not compiled. By default, models are compiled during report generation. You can control whether a model is compiled during report generation by setting the CompileModelBeforeReporting property of the slreportgen.report.Report object that includes this reporter.

Data Types: logical

Whether to include the step hierarchy, specified as true or false. If IncludeStepHierarchy is true, the report includes the step hierarchy as a nested list. The step name in the list links to the corresponding step content in the report.

Data Types: logical

Whether to include step content, specified as true or false. If IncludeStepContent is true, the report includes the content for each step. In the reported step content, the step name links to the step hierarchy in the report. You can filter the reported step content by using the IncludeStepDescription, IncludeStepWhenCondition, IncludeStepAction, IncludeStepTransitions, and IncludeStepRequirements properties.

Data Types: logical

Whether to include the step description in the content reported for a step, specified as true or false.

Data Types: logical

Whether to include the step When condition in the content reported for a step, specified as true or false. The When condition is the condition that activates a When decomposition child step.

Data Types: logical

Whether to include the step actions in the content reported for a step, specified as true or false.

Data Types: logical

Whether to include the step transitions table in the content reported for a step, specified as true or false. The step transitions table contains the transition conditions and the next steps.

Data Types: logical

Whether to include a link to the step requirements in the content reported for a step, specified as true or false. Linking to the step requirements requires Simulink Requirements™.

Data Types: logical

Table formatter for tables generated by this reporter, specified as an mlreportgen.report.BaseTable object. The default value of this property is a BaseTable object with the TableStyleName property set to the TestSequenceTable style, which is defined in the default template for a TestSequence reporter. To customize the appearance of the table, modify the properties of the default BaseTable object or replace it with your own BaseTable object. If you add content to the Title property of the BaseTable object, the content appears in front of the table title in the generated report.

Formatter for the step hierarchy list, specified as an mlreportgen.dom.UnorderedList object or mlreportgen.dom.OrderedList object. The UnorderedList or OrderedList object must not contain list items.

The default value of this property is an UnorderedList object with the StyleName property set to the TestSequenceList style, which is defined in the default template for a TestSequence reporter. To customize the appearance of the list, modify the properties of the default UnorderedList object or replace the object with your own UnorderedList or OrderedList object.

Source of the template for this reporter, specified in one of these ways:

  • Character vector or string scalar that specifies the path of the file that contains the template for this reporter

  • Reporter or report whose template is used for this reporter or whose template library contains the template for this reporter

  • DOM document or document part whose template is used for this reporter or whose template library contains the template for this reporter

The specified template must be the same type as the report to which this reporter is appended. For example, for a Microsoft® Word report, TemplateSrc must be a Word reporter template. If the TemplateSrc property is empty, this reporter uses the default reporter template for the output type of the report.

Name of the template for this reporter, specified as a character vector or string scalar. The template for this reporter must be in the template library of the template source (TemplateSrc) for this reporter.

Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar value is converted to a LinkTarget object. The link target immediately precedes the content of this reporter in the output report.

Methods

expand all

Examples

collapse all

Use an slreportgen.report.TestSequence object to report on a Test Sequence block.

Import the MATLAB Report and Simulink Report API packages so that you do not have to use long, fully qualified class names.

import mlreportgen.report.*
import slreportgen.report.*

Create a Simulink report.

rpt = slreportgen.report.Report("myTestSequenceReport","pdf");

Load a model that has a test harness.

model_name = "sltestTestSequenceExample";
load_system(model_name);

Find and load the test harness that contains the Test Sequence block to report.

harness = sltest.harness.find(strcat(model_name,"/shift_controller"));
sltest.harness.load(harness.ownerFullPath,harness.name);
testSeqObj = strcat(harness.name,"/Test Sequence");
 

Create a chapter for the Test Seqence block.

chapter = Chapter(testSeqObj);

Create a reporter for the Test Seqence block.

rptr = TestSequence(testSeqObj);

Append the reporter to the chapter and the chapter to the report.

append(chapter,rptr);
append(rpt,chapter);

Close the report, test harness, and model. View the report.

close(rpt);
sltest.harness.close(harness.ownerFullPath,harness.name);
close_system(model_name);
rptview(rpt);
Introduced in R2020b