Is it possible to ignore certain lines in MATLAB coverage test?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
If matlab version > a version
do something
else
do something else
end
I hope certain lines can be ignored based on current MATLAB version during coverage test. I'm looking for somthing similar to this post which is discussing test in Python:
2 comentarios
Manikanta Aditya
el 19 de Mzo. de 2024
Hey,
Looks like you can do Coverage Filtering for the Simulink models (Coverage Filtering - MATLAB & Simulink (mathworks.com))
For MATLAB Code, I feel there isn't built in way to ignore certain lines based on MATLAB version during a coverage test. The MATLAB code coverage tools will execute and consider all lines of code that are run during the test. If certain lines of code are not executed due to a version check, those lines would not be included in the coverage report.
If you want to exclude certain lines of code from the coverage report, you might need to structure your tests or code in such a way that those lines are not executed during testing.
Hope it helps!
Respuestas (1)
Steven Lord
el 19 de Mzo. de 2024
See the isMATLABReleaseOlderThan function. If you're using an older release, you could use verLessThan instead.
Ver también
Categorías
Más información sobre Results, Reporting, and Test File Management 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!