MSTest代码覆盖率文件太大,如何有选择地生成代码覆盖率
我的 Visual Studio 项目中有一个 MSTest 代码覆盖率设置。然而,当代码覆盖率运行时,它会生成太大的覆盖率文件(data.coverage)。原因是它扫描所有 dll、第三方库。我的项目有一些 C++ 解决方案,它为头文件中的所有方法生成代码覆盖率。请注意,在我的测试设置(local.testsettings,当前处于活动状态)中,我仅选择了一个 xyz.dll(我想要获得代码覆盖率的那个)。但是,最终的代码覆盖率包含 xyz.dll 所依赖的代码覆盖率信息。如何配置 MSTest 以使代码覆盖范围不会超出 xyz.dll 的范围? 注意:当我尝试使用 Hudson emma 插入生成 xml 报告时,拥有大的 data.coverage 文件会导致问题。最终的xml大约750MB
I have an MSTest code coverage setup in my visual studio project. However, when the code coverage runs, it generates a coverage file (data. coverage) that is too big. The reason being it scans for all the dlls, third party libraries. My project has some C++ solution and it generates code coverage for all the methods in the header files. Note that in my testsetting (local.testsettings, which is the currently active one) I have selected only a single xyz.dll (the one I want to get code coverage). However, the final code coverage contains code coverage information which xyz.dll depends on. How to configure, MSTest such that I don’t get code coverage beyond the boundaries of xyz.dll?
Note: Having a big data.coverage file cause issues when I try to generate xml reports using Hudson emma plugging. The final xml is about 750MB
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
测试覆盖率工具如何表示其记录的数据(探测位置、探测命中)显然会影响所收集的测试覆盖率数据的可管理性。
我无法说明 MS 如何编码这些数据,但很明显您对结果不满意。
我同意 750Mb 的输出似乎有点夸张。
问题可能在于,当您执行以下操作时,您只是对每个方法/函数进行了检测
只想检测 DLL。我建议您寻找一个开关来控制所检测的内容。我无法使用 MS 工具为您提供进一步帮助。
我们的C++ 测试覆盖率将让您指定只是您想要检测的文件。它确实会生成一个探针位置文件,每个探针有一个条目,但其大小与检测的代码量成正比,并且它不是一个庞大的 XML 文件。一百万行检测代码会生成几兆字节的探测位置文件。在执行时,您生成探针命中数据;在最坏的情况下,导出的数据仅以字节复数为单位测量,并且如果覆盖范围低或高,则该值要小得多。对于同样的一百万行,我预计这会是另一个兆字节。
配置我们的工具来检测 DLL 可能需要花费更多的精力; MS有控制编译器的优势,而我们没有。对于获得可用的答案来说,这似乎是一个很小的代价。
How a test coverage tool represents the data it records (probe locations, probe hits) obviously makes a difference in manageability of the collected test coverage data.
I can't speak to how MS encodes this data, but it is clear you aren't happy with the result.
I will agree that 750Mb of output seems a bit over the top.
It may be the problem is you are simply getting every method/function instrumented when you
only want the DLL instrumented. I suggest you look for a switch to control what is instrumented. I can't help you further with the MS tool.
Our C++ Test Coverage will let you specify just the files you want instrumented. It does produce a probe location file with one entry per probe, but its size is proportional to the amount of code instrumented, and it isn't a bulky XML file. A million lines of instrumented code produces a probe location file of a few megabytes. At execution time, you produce probe hit data; that exported is measured in bytes plural barely for each probe in the worst case, and is much smaller if your coverage is low or high. For the same million lines, I'd expect this to be another megabyte.
It is likely a bit more effort to configure our tool to instrument a DLL; MS has the advantage of controlling the compiler and we do not. That seems like a small price to get a usable answer.