sonar with gallio and opencover, code coverage: 0%

試著忘記壹切 提交于 2020-01-06 06:47:20

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/12813431/sonar-with-gallio-and-opencover-code-coverage-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!