Author Custom Test Objective Workflow
Enhanced Modified Condition Decision Coverage (MCDC) considers the default coverage objectives of a test block that are detectable at the detection site. To check the detectability status of a custom test objective, you can author the test objective of a model object, and perform Enhanced MCDC analysis.
Consider this model that consists of a Product block and a
Min block. You can author a custom test objective for the
Product block to render the output value less than
0 and detect the effect of the custom test objective at a
Steps for Authoring Custom Test Objectives
This workflow describes the steps for authoring custom test objectives for a block.
Step 1: Create a library of atomic masked subsystem to author the custom test objectives. The masked subsystem consists of these blocks:
Block under consideration, for example, a Product block.
Logic to encode the custom test objective, for example, a MATLAB Function block.
Simulink® Design Verifier™ Test Objective blocks.
Step 2: In the masked subsystem:
isEnabledForDetectabilityparameter and set the parameter to
detectBlockparameter with the name of the block under consideration.
Evaluateattribute of the
Step 3: Define the block replacement rule to replace the block under consideration with a masked subsystem.
To author custom test objectives, use
blkrep_rule_product_customTestObjective.m block replacement
rule example file. In the block replacement file, you update the
based on your model blocks. For more information, see Block Replacements for Unsupported Blocks.
Step 4: Configure your model with the block replacement rule. In the Configuration Parameters dialog box, in Design Verifier > Block Replacements pane, enter the List of block replacement rules.
Step 5: Select
for Model coverage objectives and perform test generation
Analyze Custom Test Objectives in Model for Enhanced MCDC
This example shows how to author custom test objectives for the Product block in the
sldvCustomTestObjectiveExample model. Then, it shows how you can detect the effect of the test objective at a detection site.
1. Open the
Library of atomic masked subsystem: The
blkReplacementlib_customTestObjective library consists of the
custProduct masked subsystem. The logic to encode the custom test objective is defined in the MATLAB Function block. The
getCustomTestObjectives MATLAB Function block consists of two custom conditions for the Test Objective blocks.
custProduct masked subsystem is preconfigured with these parameters. For more information, see Mask Editor Overview.
Block replacement rule to replace the block under consideration with a masked subsystem: The
sldvCustomTestObjectiveExample model is preconfigured with the block replacement options. The block replacement rule is defined in the
blkrep_rule_product_customTestObjective file that replaces the Product block with the
custProduct masked subsystem.
2. To configure the model for enhanced MCDC objectives, on the Design Verifier tab, click Test Generation Settings. In the Configuration Parameters dialog box, in Design Verifier > Test Generation pane, for Model coverage objectives, select
Enhanced MCDC. Click OK.
3. To generate test cases, click Generate Tests.
The software analyzes the replacement model for test generation.
4. Click Highlight analysis results on model. To analyze the detectability of the Product block, click the Product block.
The results show that the test objectives of the Product block are detectable. The test case is generated.
Note: The software is unable to confirm the objectives status through validation results for the objectives introduced by block replacement. Therefore, the test objective status is reported as satisfied - needs simulation. For more information on validation, see How Simulink Design Verifier Reports Approximations Through Validation Results.
5. Click View test case. The harness model opens and the Signal Builder block displays the test case.
6. To view the detailed analysis report, click HTML in the Results Summary. The Block Replacement Summary provides details about the replaced blocks.
The Test Objectives Status section lists the objectives. The test objective that is detectable at the detection site is summarized in the table.