Why do I get a warning that the code coverage result is empty because the file is invalid?
Show older comments
I'm trying to add code coverage to my unit test suite. There is one .mlapp file that gives this warning:
Warning: Coverage result is empty for /MyPath/myApp.mlapp because the file is invalid.
How can I find out what is wrong with the file? The app works, so I don't know why it would be "invalid." Note: a blank .mlapp file does not give the same warning.
Answers (2)
Rich006
on 19 Jun 2024
2 votes
1 Comment
Ernst van der Pols
on 5 Jul 2024
Edited: Ernst van der Pols
on 5 Jul 2024
I encountered the same problem: a warning with the wrong filename in case of an invalid m-file in the folder that is part of the CodeCoverage.
BUG:
In createFromCodeCoverageCollectorData.m (R2023b) line 21 the filename argument of the warning message for the FAILED files(1) is now staticData{ii}.fileName while it should be files(1).path. (disclamer: seems the logic fix based on my situation).
WORKAROUND:
Put a breakpoint on line 20 in createFromCodeCoverageCollectorData.m and inspect files(1).path of files(1).shortPath to identify the failed file.
Himanshu
on 21 Nov 2023
0 votes
Hey,
I understand that you are trying to add code coverage to a unit test suite.
Please note that producing code coverage reports is not supported with MATLAB Compiler. Since App Designer uses the MATLAB Compiler, producing code coverage reports gives you a warning.
Hope this helps!
1 Comment
Rich006
on 27 Nov 2023
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!