Why does "Record coverage for system under test" alters the test results in "Simulink Test Manager" in MATLAB R2024b?

6 views (last 30 days)

For my model shown below, I have two test cases in my Test Suite. Both the test cases are identical except,
Test Case 1 has "Record coverage for system under test" option turned OFF under "Coverage Settings". 
Test Case 2 has "Record coverage for system under test" option turned ON under "Coverage Settings". 
 
When the tests are run,
Test Case 1 passes
Test Case 2 fails and the following error is observed in the report:

Division by zero in 'example/Divide'
Here's an example model, "example.slx":

Test harness:

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 19 Nov 2024 at 0:00
If "Block Reduction" is ON and "Force Block Reduction Off" is enabled, block reduction becomes inactive when coverage is on. This alters the test results when "Record coverage for system under test" is enabled. 
To have same results for both the test cases, disable "Force Block Reduction Off". This will pass both the test cases, and no error will be encountered. 
Block Reduction reduces the number of blocks in the model that execute during simulation by collapsing groups of blocks into a single, more efficient block or eliminates unnecessary blocks from the execution list.  If "Force Block Reduction Off" parameter is selected, the coverage analysis overrides the value of the Block reduction Simulink parameter.

More Answers (0)

Categories

Find more on Results, Reporting, and Test File Management in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!