Unit test code coverage

2 visualizaciones (últimos 30 días)
Mohamed AKI Ahmed
Mohamed AKI Ahmed el 23 de Jun. de 2022
Comentada: Chi el 20 de En. de 2023
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.

Respuestas (1)

Steven Lord
Steven Lord el 23 de Jun. de 2022
Add matlab.unittest.plugins.CodeCoveragePlugin to your test runner as shown on this documentation page.
  2 comentarios
Mohamed AKI Ahmed
Mohamed AKI Ahmed el 23 de Jun. de 2022
what's the differance between the test runner and runtests? which one is better to use?
Chi
Chi el 20 de En. de 2023
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Run Unit Tests en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by