Test Sequence Editor

The Test Sequence Editor enables you to define and modify test sequences for Test Sequence and Test Assessment blocks. To open the Test Sequence Editor, double-click a Test Sequence or Test Assessment block.

Define Test Sequences

A test sequence consists of test steps arranged in a hierarchy. Test steps can contain transitions that define how a test progresses in response to the simulation. Test steps can also have a When decomposition that uses logic similar to an if-elseif-else statement. By default:

  • New Test Sequence blocks contain two standard transition test steps.

  • New Test Assessment blocks contain a When decomposition test step with two sub-steps.

For more information, see Transition Types.

To define a test sequence:

  1. Add test steps, as described in Manage Test Steps.

  2. In the Step cell, define outputs and assessments.

  3. To add a transition from a test step:

    1. Point to the Transition cell and click Add transition.

    2. In the Transition cell, define the conditions for exiting the step.

    3. In the Next Step cell, select the next test step from the drop-down list.

  4. To define a step with a When decomposition:

    1. Right-click a test step and select When decomposition. The step displays the icon .

    2. Add sub-steps, as described in Manage Test Steps.

    3. In the Step cell of each sub-step, enter the when operator, followed by a condition. Do not add a condition to the last sub-step.

Manage Test Steps

In the Test Sequence Editor, you can add and delete test steps to your test sequence. You can also reorder the test steps and change their position in the hierarchy.

Add and Delete Test Steps

To add a test step, right-click an existing step and select Add step before or Add step after.

To add a test step in a lower hierarchy level, right-click the parent step and select Add sub-step.

To delete a test step, right-click the step and select Delete step. If the test sequence contains only one test step, you cannot delete it. You can delete its contents by selecting Erase last step content.

Copy and Paste Test Steps

To copy a test step, right-click the area to the left of the step name and select Copy step. Alternatively, select the test step and use the shortcut Ctrl+C.

To cut a test step, right-click the area to the left of the step name and select Cut step. Alternatively, select the test step and use the shortcut Ctrl+X.

To paste a test step, right-click the area to the left of a step name and select Paste step, then:

  • Paste before step

  • Paste after step

  • Paste sub-step

Alternatively, select the test step and use the shortcut Ctrl+V.

Reorder Test Steps and Transitions

To reorder the test steps in a test sequence:

  1. Point to a test step. The icon appears to the left of the step name.

  2. Click and drag the icon to reorder the test step.

You can reorder test steps within the same hierarchy level. When you move a test step, any sub-steps move with the test step.

To reorder step transitions within the same test step, click and drag a transition number to reorder the transition. The corresponding next step moves with the transition.

Change Test Step Hierarchy

To move a test step to a lower level in the hierarchy, right-click the step and select Indent step. You can only indent a test step when the preceding step is at the same hierarchy level. You cannot indent the first test step in a sequence or the first step in a hierarchy group.

To move a test step to a higher level in the hierarchy, right-click the step and select Outdent step. You can only move the last step in a hierarchy group to a higher level in the hierarchy.

Manage Input, Output, and Data Objects

In the Symbols sidebar of the Test Sequence Editor, you add, edit, or delete symbols in the Test Sequence block. You can access these symbols from test steps at any hierarchy level. To show or hide the Symbols sidebar, click the Symbols Sidebar button on the Test Sequence Editor toolbar.

To add a data symbol, point to the node for a symbol type and click an add symbol button. Available options and additional setup steps depend on the symbol type.

Symbol TypeDescriptionProcedure for Adding Symbol
Input

Options for input entries include:

  • Data

  • Messages

  1. In the Symbols sidebar, point to the Input node and click either:

    • Add data

    • Add message

  2. Enter the name of the input and press Enter.

Output

Options for output entries include:

  • Data

  • Messages

  • Function Calls

  • Triggers

  1. In the Symbols sidebar, point to the Output node and click:

    • Add data

    • Add message

    • Add function call

    • Add trigger

  2. Enter the name of the output and press Enter.

Local

Local data entries are available only inside the Test Sequence block in which they are defined.

  1. In the Symbols sidebar, point to the Local node and click Add data.

  2. Enter the name of the local variable and press Enter. Initialize the local variable in the first test step.

Constant

Constants are read-only data entries available only inside the Test Sequence block in which they are defined.

  1. In the Symbols sidebar, point to the Constant node and click Add data.

  2. Enter the name of the constant and press Enter.

  3. Point to the name of the constant and click Edit.

  4. In the dialog box, in the Constant Value field, enter the value of the constant.

Parameter

Parameters are available inside and outside the Test Sequence block.

  1. Using the Model Explorer, add a parameter in the workspace of the model that contains the Test Sequence block.

  2. In the Symbols sidebar, point to the Parameter node and click Add data.

  3. Enter the name of the parameter and press Enter.

Data Store Memory

Data Store Memory entries are available inside and outside the Test Sequence block.

  1. Using the Model Explorer, add a Simulink.Signal object in the workspace of the model that contains the Test Sequence block. Alternatively, add a Data Store Memory block to the model.

  2. In the Symbols sidebar, point to the Data Store Memory node and click Add data.

  3. Enter the name of the data store and press Enter.

To edit a data symbol, point to the name of the symbol and click Edit.

To delete a data symbol, point to the name of the symbol and click Delete.

Find and Replace

You can find and replace text in Test Sequence actions, transitions, and descriptions by using the Find & Replace tool in the Test Sequence Editor.

  1. To open the Find & Replace tool, click the icon in the toolbar.

  2. In the Find what field, enter the text you want to locate.

  3. In the Replace with field, enter the updated text.

  4. To locate the text, click Find Next or Find Previous.

  5. To replace the old text with the updated text, click Replace.

When running a search, the Find & Replace tool searches descriptions only if the description column is open.

Automatic Syntax Correction

The Test Sequence Editor changes the syntax automatically for:

  • Duplicate test step names. For example, if step_1 exists, and you change another step name to step_1, the step name you change automatically changes to step_2.

  • Increment and decrement operations, such as a++ and a--. For example, a++ is changed to a=a+1.

  • Assignment operations, such as a+=expr, a–=expr, a*=expr, and a/=expr. For example, a+=b is changed to a=a+b.

  • Evaluation operations, such as a!=expr and !a. For example, a!=b is changed to a~=b.

  • Explicit casts for literal constant assignments. For example, if y is defined as type single, then y=1 is changed to y=single(1).

See Also

|

Related Topics