Unit test code coverage
조회 수: 6 (최근 30일)
이전 댓글 표시
I have a bunch of unittest files that I run using
runtests(pwd,'IncludeSubfolders', true)
I want to know how can I add the code coverage to that line. I read something about 'ReportCoverageFor'but I couldn't use it.
댓글 수: 0
답변 (1개)
Steven Lord
2022년 6월 23일
Add matlab.unittest.plugins.CodeCoveragePlugin to your test runner as shown on this documentation page.
댓글 수: 2
Chi
2023년 1월 20일
From the documentation page above,
"runner = testrunner creates a default test runner, which is similar to the runner that the testing framework configures by default when you call the runtests function."
The short answer is that a testrunner is more customizable with additional plugins, see Customize Runner to Generate Test Artifact.
참고 항목
카테고리
Help Center 및 File Exchange에서 Run Unit Tests에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!