提问人:Rich006 提问时间:11/16/2023 更新时间:11/16/2023 访问量:12
如何防止在运行 Matlab 代码覆盖率报告时出现无效文件警告?
How can I prevent an invalid file warning when running a Matlab code coverage report?
问:
概述
我从 Matlab 的代码覆盖率中收到一个警告,说文件“无效”,我想删除该警告。我能想到两种方法,但我不知道如何完成其中任何一种。我的想法是:
- 修复该文件,以便插件不会将其标记为无效。(首选)
- 告诉 Matlab 代码覆盖率插件忽略该文件。(可接受)
详
我有一个文件runTests.m,用于导入用于单元测试的Matlab代码覆盖率插件:
import matlab.unittest.TestRunner
import matlab.unittest.plugins.CodeCoveragePlugin
import matlab.unittest.plugins.codecoverage.CoverageReport
当我运行测试时,它们都通过了,并且覆盖率报告似乎具有正确的信息,除了一个 App 设计工具文件。对于该文件,我收到以下警告:
Warning: Coverage result is empty for /MyPath/myApp.mlapp because the file is invalid.
如何告诉代码覆盖率插件忽略 App 设计工具 .mlapp 文件?该应用程序可以正常工作,所以我不知道为什么它是无效的。如果我在新的空白应用上运行相同的测试套件,则不会出现警告。
警告输出的其余部分为:
In matlab.coverage.internal.ResultBuilder.createFromCodeCoverageCollectorData (line 20)
In matlab.coverage.internal/ResultBuilder/create (line 73)
In matlab.coverage.internal.getResults (line 11)
In matlab.unittest.internal.coverage.CodeCoverageCollector.get.Results (line 65)
In matlab.unittest.internal.plugins.CodeCoverageCollectionPlugin.runTestSuite/assignResultsAndResetProfilerCollector (line 25)
In matlab.unittest.internal.plugins.CodeCoverageCollectionPlugin>@()assignResultsAndResetProfilerCollector(plugin,pluginData.CommunicationBuffer) (line 22)
In onCleanup/delete (line 25)
In matlab.unittest.internal.plugins/CodeCoverageCollectionPlugin/runTestSuite (line 20)
In matlab.unittest.plugins/CodeCoveragePlugin/runTestSuite (line 350)
In matlab.unittest.plugins/TestRunnerPlugin/runTestSuite (line 265)
In matlab.unittest.plugins.xml/JUnitXMLOutputPlugin/runTestSuite (line 66)
In matlab.unittest/TestRunner/evaluateMethodOnPlugins (line 425)
In matlab.unittest.internal/SerialTestRunStrategy/runTestSuite (line 36)
In matlab.unittest.internal/SerialTestRunStrategy/runSession (line 16)
In matlab.unittest/TestRunner/runSession (line 1260)
In matlab.unittest.plugins/TestRunnerPlugin/runSession (line 228)
In matlab.unittest.plugins/CodeCoveragePlugin/runSession (line 345)
In matlab.unittest.plugins/TestRunnerPlugin/runSession (line 228)
In matlab.unittest.plugins.xml/JUnitXMLOutputPlugin/runSession (line 58)
In matlab.unittest/TestRunner/evaluateMethodOnPlugins (line 425)
In matlab.unittest/TestRunner/doRunWithFcn (line 413)
In matlab.unittest/TestRunner/run (line 297)
In runTests (line 55)
答: 暂无答案
评论