Main Content

Generate Test Cases for Model Blocks

This example shows how to generate a test case for Model block that models a power window controller in Simulink® Design Verifier™.

Step 1: Open the Model

The top-level model represents a power window verification system. The model contains a model reference that represents a power window controller model and that specifies the controller behavior and the modeled requirements.

To open the model of the top-level verification system, enter:

open_system('sldvdemo_powerwindow_vs');

The model reference points to the model sldvdemo_powerwindowController, which responds to the driver and passenger commands by giving the commands for moving the window up or down. The model also responds if the window encounters an obstacle or if it reaches the end of the window frame in either direction.

Step 2: Specify Analysis Options

Specify the analysis options for test case generation:

1. On the Design Verifier tab, change the mode to Test Generation.

2. Click Test Generation Settings.

3. From Test Generation pane in the Configuration Parameters dialog box, set Model coverage objectives to MCDC.

4. Click OK.

Step 3: Perform Analysis and Review Results

Perform test case generation on the Model block:

1. Right-click the Model block and select Design Verifier > Generate Tests for Referenced Model. Alternatively, in the Design Verifier pane, in the Analyze section, click the unpin button, then select the Model block. Then click Generate Tests.

2. Simulink Design Verifier generates test cases for the Model block. The Results window shows that the test generation completed normally.

3. To access the deatiled analysis report, click HTML in the Results window. The analysis report shows that 170 objectives are satisfied and eight objectives are unsatifiable out of the 178 objectives processed.

Step 4: Clean Up

To complete the example, close the opened model.

close_system('sldvdemo_powerwindow_vs',0);

Related Topics