开发者

.NET code coverage tools don't work on native applications that load .net assemblies

I am writing a plug-in module for Revit Architecture, which provides a .NET API. Essentially, you create an assembly with classes that implement a specific interface. Revit then loads the assembly and makes calls to the interface.

I would like to be able to get ongoing code coverage metrics for my plug-in code, but have found that all of the typical code coverage tools (NCover, PartCover, dotCover) do not work in this case, because the host Revit application (Revit.exe) is a Windows native application, not a managed application. The NCover documentation specifically states that NCover will not work if the process being co开发者_如何学Pythonvered is a native application process. I am assuming that the instrumentation techniques used by the other tools are similar and thus have the same root cause for not working.

I would like to know if there is a workaround for this case for any of the above tools, or if there is another code coverage tool or technique that I could use. TIA.


Our C# Test Coverage Tool should work for this.

It works by instrumenting the source code; you run the instrumented source code (by whatever method, including the traditional compile-and-run techniques). Consequently it doesn't care how the code gets executed, only that it somehow gets executed. Instrumentation data is collected in an added class, and you have have complete control over how and when that data gets exported, so you can export from an arbitrary environment.


NCover, PartCover and dotCover are .NET coverage tools and do so by instrumenting the IL (I know PartCover and NCover do so by using the ICorProfilerCallback interfaces and JITCompilationStarted events and such like) to gather coverage information and as such they do not know how to handle native code (even though they are actually written in Native code.).

I can't profess to know how dotCover works.

If you are looking at getting coverage for a native aplication I would look at tools such as Coverage Validator

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜