开发者

Method exclusion in PartCover

开发者 https://www.devze.com 2023-03-22 07:43 出处:网络
I am trying to modify the PartCover source code to exclude coverage by method. However,it looks like the main logic is in the c++ code. Since it is not p开发者_开发技巧ossible to step into the cpp cod

I am trying to modify the PartCover source code to exclude coverage by method. However,it looks like the main logic is in the c++ code. Since it is not p开发者_开发技巧ossible to step into the cpp code while debugging,can someone please guide me as to which files I would need to modify? I am thinking it should be rules.cpp and instrumentator.cpp...and some refactoring needed in other .cpp .h and .cs files due to changes made in these. But If I am wrong, or if there are other places that I should also be looking at, please let me know. Any other hint to proceed would also be appreciated.

Thanks,


Thanks for your reply. However, uncommenting the DebugBreak is causing the nunit-console-86.exe to stop working. I changed the NUnit version to 2.5.7 to match it with the version of nunit-framework.dll inside the PartCover bin folder, but the problem still exists. Any idea what could be causing this?

We have our own console app that runs coverage check method wise. It makes sure if any new method is added, or code in existing methods refactored, the coverage still should be at least more than our decided percentage. Sometimes there are methods for which testing cannot be done completely for whatsoever reason. For those, it doesn't make sense to exclude the entire class.


The files you have mentioned are probably the best places in the C++ code to apply your extra filter. I assume you have a way of extending the syntax currently used for include and exclude filters of modules and classes.

You can debug the code if you uncomment the DebugBreak in CorProfiler::Initialize (when you .NET process runs and the profiler is loaded this will allow you to attach a C++ debugger to the profiler)

May I ask why you need to exclude specific methods? I can see the need to exclude classes i.e. Test Classes and the like but not specific methods, this seems like something that could be easier done if necessary be just ignoring the results in any reports.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号