Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Metric not calculate tests coverage satelite dll by tests from main program
k_samsonov
#1 Posted : Tuesday, June 17, 2014 1:27:32 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/17/2014(UTC)
Posts: 5
Location: Russia

Thanks: 1 times
Solution with two project exe and dll. Exe refer to dll. Both projects has tests.

Metric not calculate tests coverage in dll by tests from exe.

Remco
#2 Posted : Tuesday, June 17, 2014 10:34:39 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for posting!

What is the nature of the reference between these projects? Has NCrunch given you any warning about lost references?

Do you see anything in this documentation page that may apply to your situation? http://www.ncrunch.net/documentation/troubleshooting_missing-code-coverage.


Cheers,

Remco
k_samsonov
#3 Posted : Thursday, June 19, 2014 8:47:16 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/17/2014(UTC)
Posts: 5
Location: Russia

Thanks: 1 times
May be I not clear describing situation. If tests in exe cover some code in dll this not calculated in Metrix pane. Maybe need make settings coverage some satellite dll.
Remco
#4 Posted : Thursday, June 19, 2014 9:40:27 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Sorry - Could you clarify for me ... Is the DLL file derived from a project that is part of your solution? If so, do you see any coverage markers for this project's source code inside the code windows?
k_samsonov
#5 Posted : Monday, June 23, 2014 6:23:17 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/17/2014(UTC)
Posts: 5
Location: Russia

Thanks: 1 times
1. Two projects in solution, EXE has reference to DLL as DLL from debug folder.
2. With coverage marks all ok, all tests covered code mark green
but
if test in EXE cover code in DLL
a) such code not marked as covered by test
b) not calculated in Metric Pane

I create a litle project for demonstration
(- BROKEN LINK -)



Remco
#6 Posted : Monday, June 23, 2014 11:29:06 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks for taking the time to make the sample project. This helped to highlight the issue very quickly.

The problem is being caused by a 'Lost reference' between the projects. When creating a reference between projects in the IDE, make sure you do so using a 'ProjectReference' and not a 'Reference'. Referencing the DLL in its output directory prevents NCrunch from correctly identifying the reference, resulting in strange build behaviour and lost code coverage data.

NCrunch will usually warn you about this situation with the following message:

"This component is referencing at least one DLL with a name identical to another project within this solution. This is commonly done by mistake when setting up references between projects, as usually cross-project references should point to referenced projects and not to their output binaries. NCrunch specifically uses project references to identify normal dependencies between projects inside and around your solution, so you may notice a loss of test code coverage for the referenced project. The correct way to resolve this problem is to replace any references to project output binaries with proper project references. If the reference is pointing to a DLL on purpose (for example, if you are making use of two different versions of a component within the same solution), then you may be able to ignore this warning.

If you are working in a solution where project references are being intentionally represented as assembly references, you may wish to consider turning on the 'Infer Project References Using Assembly Names' configuration setting. Be warned that use of this setting may mask some serious underlying problems with your solution's build structure and it should only be used as a last resort.

The following referenced assemblies appear as though they should be project references:
CoverageTestDLL"
k_samsonov
#7 Posted : Tuesday, June 24, 2014 8:06:35 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/17/2014(UTC)
Posts: 5
Location: Russia

Thanks: 1 times
Thanks for answer. I think when I make continuous integration server I should break project reference and replace it by dll reference. May be you can add feature "list dll to instrument for coverage tests" ... in future ))).
Remco
#8 Posted : Tuesday, June 24, 2014 10:12:04 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
There is a way you can work around this without needing to swap the Reference for a ProjectReference - if you enable this setting: http://www.ncrunch.net/documentation/reference_solution-configuration_infer-project-references-using-assembly.
1 user thanked Remco for this useful post.
k_samsonov on 6/26/2014(UTC)
k_samsonov
#9 Posted : Thursday, June 26, 2014 8:21:20 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/17/2014(UTC)
Posts: 5
Location: Russia

Thanks: 1 times
Yes!!! This is work! Thank you very much!
Remco
#10 Posted : Thursday, June 26, 2014 9:23:17 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Welcome! :)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.056 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download