Why do I receive the following warning when using the CodeCoveragePlugin in MATLAB R2022b: "The code coverage metrics for the MATLAB source file might be outdated"?

1 visualizzazione (ultimi 30 giorni)

We have a MATLAB code base that has been supported on MATLAB R2018b and R2019b. As part of test execution, we instruct the MATLAB test runner to collect coverage via the CodeCoveragePlugin. We recently updated the code base to support MATLAB R2022b, but when executing our test suite, we now receive this warning message:

Warning: The code coverage metrics for the MATLAB source file might be outdated. To produce an accurate coverage report, consider updating the P-file before running your coverage session.
Can you provide more details about this change in the Code Coverage implementation for MATLAB R2022b and why we receive this warning?

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 15 Mar 2024
Code Coverage reporting requires an accurate copy of the source code which is obtained from the M file. In previous releases, you could silence the warning about the P-code being out of date by using the "touch" command on the P-file, but that did not ensure the files were consistent.
Beginning in MATLAB R2022a, the Code Coverage report shows function and statement coverage. Previous releases reported line coverage. As part of this work, the P-file validation is now more accurate. When the contents of the files don't match, the observed warning is produced. This lets you know that the report will not be correct. Please note that the report was incorrect in previous releases too, MATLAB just did not produce a warning about it. Now MATLAB tells you that the report is incorrect.
If you do not wish to see these warnings, you can suppress or turn off the warnings by following the instructions in the following documentation page:

Più risposte (0)

Categorie

Scopri di più su MATLAB Report Generator in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by