Coverage report from unit tests is inaccurate
11 ビュー (過去 30 日間)
古いコメントを表示
Using the matlab.unittest.plugins.CodeCoveragePlugin with class-based unit tests produces coverage reports that are not always accurate. I see them repeatedly (but not always) occur when function handles are split across multiple lines. The following image provides an example (code to reproduce it is attached).
The "missed line" goes away if you replace isequal(x) with x == x in line 4. Also, if you just remove the ellipsis and have the function handle defined entirely on one line, the report does not display a "missed line."
0 件のコメント
回答 (1 件)
Neeraj Badamikar
2021 年 6 月 17 日
Hello Micah,
Thank you for reporting this. We've had a few other users reporting about this issue and we are working on addressing it.
One possible solution we're looking at is to report code coverage on entire MATLAB statements as opposed to lines. That would ensure that a statement like this -
function_handle_with_wrapping_line_for_isequal = @(x) ~isequal(x, x) || ...
isequal(x, x);
would either be marked as covered or not covered in entirety.
Is that something that you would find useful?
Regards,
Neeraj
4 件のコメント
参考
カテゴリ
Help Center および File Exchange で Address Missing Coverage についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!