Obtaining coverage stats for an Excel addin

We have an Excel addin (xll) created using Excel DNA from standard C# code. We'd like to generate coverage stats for code within the xll when running integration tests via MSTest. The flow of control is as follows:

- test starts
- Code within the test launches Excel via COM automation (Excel is now a separate process)
- Code within the test instructs Excel to load the xll
- COM automation is used to setup the relevant test conditions
- Results verified with COM calls
- xll unloaded, Excel shutdown
- .... next test runs

At the moment DotCover gives us coverage within the calling process, but no visibility of code within the XLL.

Solution structure
- Integration tests project - coverage of XLL not currently shown
- Xll project (builds a DLL which is then converted/packed as an XLL)

Is it possible to get the child process/addin coverage information somehow? Is this something dotCover supports? If the XLL was a plain DLL would this be easier?

Thanks,
Barney

p.s. More info on Excel DNA here - http://excel-dna.net/

4 comments
Comment actions Permalink

Hello,

We have an issue related to profiling child processes from Visual Studio via dotCover in our issue tracker and we are working on resolving it. But you still can get child processes covered. You can either profile/cover any .NET process (choose '.NET Process' in the 'Cover Application' dialog box) or use dotCover console runner (http://www.jetbrains.com/dotcover/webhelp/dotCover__Console_Runner_Commands.html).

 

Kind regards,
Maria

0
Comment actions Permalink

Hi Maria,

I have tried this using :

dotCover.exe cover /TargetExecutable=MSTest.exe /TargetArguments="/testcontainer:[MyTestDLL]"  /TargetWorkingDir="[TestDLLDirectory"  /Output=Coverage.dcvr

However, I still get the same result. Does the fact that Excel sits in the middle as a non .NET process cause a problem? The process tree will look something like this:

dotCover -> MSTest (loads test DLL) -> Excel (launched via COM) -> loads XLL addin (.NET DLL within)

Thanks,
Barney

0
Comment actions Permalink

Hello Barney,

Do you have the corresponding pdb file for the .NET dll that needs to be covered? Are assemblies being shadow copied during the process? Have you tried to cover from Visual Studio ('.NET Process' in the 'Cover Application' dialog box)? After getting coverage results, please turn off solution structure matching ('Match coverage results with current project structure' on the toolbar of 'Unit Test Sessions' window).



Kind regards,
Maria

0
Comment actions Permalink

Hi Maria,
Yes I have the PDB file. It is in the same directory as the XLL. The DLL is packed into the XLL (https://exceldna.codeplex.com/wikipage?title=Excel-DNA%20Packing%20Tool). I can see how this might make tracking of coverage rather challenging!
I'm going to park this for now.
Thanks,
Barney

0

Please sign in to leave a comment.