0

I'm using sonar to check my c# project. I would like to measure code coverage that's why i installed gallio and opencover. When I run soner-runner everything works fine, my unit test is performed, ... but the code coverage is 0% on the sonar web UI.

do you know the reason why the code coverage is 0%?

My solution, project and classes: (S) SonarTestSolution (P) ClassLibrary1 (C) Class1.cs (P) ClassLibrary1NUnitTest (C) Class1NUnitTest.cs

content of Class1.cs:

public class Class1  {
    public String getTestString() {  return "abc";}
}

content of Class1NUnitTest.cs:

   [TestFixture]
    public class Class1NUnitTest    {
        [Test]
        public void createServiceFromFactoryTest()  {
            Class1 c = new Class1();
            Assert.That(c.getTestString(), Is.EqualTo("abc"));
    }}

sonar-project.properties:

  sonar.projectKey=cs_sonar_test
  sonar.projectVersion=1.0-SNAPSHOT
  sonar.projectName=C# Sonar Test Project
  sonar.sourceEncoding=UTF-8
  sources=.
  sonar.language=cs
  sonar.donet.visualstudio.testProjectPattern=*NUnitTest*

If you want I can include the log og sonar-runner, and the generated coverage-report.xml and gallio-report.xml files

Peter
  • 27,590
  • 8
  • 64
  • 84
user1414731
  • 35
  • 1
  • 6

1 Answers1

0

solved - the project was build another machine, this was the problem. Building the solution in the same folder solves the proble.

user1414731
  • 35
  • 1
  • 6
  • Not sure why that would be a problem as long as you have all the PDBs available. The location is only important when visualising the code coverage as the path to the source files is contained in the PDB files – Shaun Wilde Oct 12 '12 at 22:10