Branch Coverage?

Branch Coverage?

Hello,

I'm using the combination of the following programs: Visual Studio 2005 TestDriven.net trial version NUnit NCover trial version

I have written some Code and Unit Tests in Visual Studio. Now I want to check the branch coverage. If I do the following steps, no branch coverage is displayed?!: 1) right klick on my UnitTest 2) "Test With" -> "Coverage" 3) Then the NCoverExplorer (2.1.2.3433) opens automatically. But neither in the NCoverExplorer nor in the generated HTML report I can see the Branch coverage.

Please help me.

regards Robert


RE: Branch Coverage?

NCE 2.1.2 does not know how to handle branch coverage; as a side effect, it strips branch coverage data from any coverage it loads. This bug has been fixed in NCover v3 (currently in open Beta). If you want to see branch coverage in v2.1.2, pass NCover.Console the //h argument.


RE: Branch Coverage?

Thank you for the quick answer :-)

I'll try NCover v3 (Beta) and NCover.Console.

regards Robert


RE: Branch Coverage?

Now I have used NCover in the Console: NCover.Console ConsoleApplication2.exe //h c:\ In the generated HTML report a branch coverage of 100% is displayed for this code:

class Program { static void Main(string[] args) { Program prog = new Program(); int z = prog.testBranchCoverage(0, 2); Assert.AreEqual(4, z); }

public int testBranchCoverage(int x, int y) { int z = x; if (y > x) z = y; z *= 2; return z; } }

My Question: Is the branch coverage method used by NCover the same as the branch coverage in theory? Because an if statement has to be checked for more than one time to get a branch coverage of 100%.


RE: Branch Coverage?

the branch coverage definition in NCover is not the same as the def in theory. we are re-examining the implementation, but right now it's easiest to think of it as whether every node (not edge) in the cyclomatic complexity graph of the method has been covered.

Stephen


RE: Branch Coverage?

Thank you for this information.

Robert