0

is there anyone out there who actually managed to get sonar-runner working with Gallio and Ncover? I've tried every combination in the book and during the run it keeps telling me

"INFO s.p.c.g.GallioSensor - Gallio won't execute as there are no test projects."

if I run everything separately (NCover, Gallio) they give results , just not with Sonar-runner

please help!!!

this is what my config looks like btw (sonar-project.properties file)

# Project identification
sonar.projectKey=DMG:PilotCompletePackageSolution
sonar.projectVersion=4.0.0  
sonar.projectName=Pilot Filepointer

# Info required for Sonar  
sources=.  
sonar.language=cs  

#Core C# Settings  
sonar.dotnet.visualstudio.solution.file=FilePointer.sln  

#Gendarme  
sonar.gendarme.assemblies=\build\\DmgTech*.*  
sonar.gendarme.mode= 

# Gallio  
sonar.gallio.mode=
sonar.gallio.reports.path=bin/
sonar.gallio.installDirectory=C:/program files (x86)/gallio
sonar.gallio.coverage.tool=NCover
sonar.donet.visualstudio.testProjectPattern=*test*
sonar.donet.visualstudio.testProjectPattern=*Test*
sonar.donet.visualstudio.testProjectPattern=*Tests
sonar.donet.visualstudio.testProjectPattern=*UnitTest*  
sonar.NCover.installDirectory=c:/Program Files(x86)/NCover

# FXCop  
sonar.fxcop.mode=  

#StyleCop  
sonar.stylecop.mode=

#NDeps
sonar.ndeps.mode=

Update

this is the sonar created coverage:

<?xml version="1.0" encoding="utf-8"?>
<!-- saved from NCover 3.0 Export url='http://www.ncover.com/' -->
<coverage profilerVersion="3.4.18.6937" driverVersion="3.4.18.6937" exportversion="3" viewdisplayname="" startTime="2012-05-11T08:07:34.8625409Z" measureTime="2012-05-11T08:07:40.7988805Z" projectName="New Project" buildid="734ad123-bd97-46c4-acfe-2ad0386b4d6a" coveragenodeid="0" failed="false" satisfactorybranchthreshold="95" satisfactorycoveragethreshold="95" satisfactorycyclomaticcomplexitythreshold="20" satisfactoryfunctionthreshold="80" satisfactoryunvisitedsequencepoints="10" uiviewtype="TreeView" viewguid="New Project" viewfilterstyle="None" viewreportstyle="SequencePointCoveragePercentage" viewsortstyle="Name">
  <rebasedpaths />
  <filters />
  <documents>
    <doc id="0" excluded="false" url="None" cs="" csa="00000000-0000-0000-0000-000000000000" om="0" nid="0" />
  </documents>
</coverage>

and this is the manual coverage:

<?xml version="1.0" encoding="utf-8"?>
<!-- saved from NCover 3.0 Export url='http://www.ncover.com/' -->
<coverage profilerVersion="3.4.18.6937" driverVersion="3.4.18.6937" exportversion="3" viewdisplayname="" startTime="2012-05-10T06:06:29.2440585Z" measureTime="2012-05-10T06:06:31.6464627Z" projectName="New Project" buildid="2c2073a0-18a6-4976-8858-c16755d1d1ff" coveragenodeid="0" failed="false" satisfactorybranchthreshold="95" satisfactorycoveragethreshold="95" satisfactorycyclomaticcomplexitythreshold="20" satisfactoryfunctionthreshold="80" satisfactoryunvisitedsequencepoints="10" uiviewtype="TreeView" viewguid="New Project" viewfilterstyle="None" viewreportstyle="SequencePointCoveragePercentage" viewsortstyle="Name">
  <rebasedpaths />
  <filters />
  <documents>
    <doc id="1" excluded="false" url="C:\tfsdata\FilePointer\UITest\UnitTest.cs" cs="81FA01B2B109478673AC792E586754E5" csa="406ea660-64cf-4c82-b6f0-42d48172a799" om="1" nid="0" />
    <doc id="0" excluded="false" url="None" cs="" csa="00000000-0000-0000-0000-000000000000" om="0" nid="0" />
  </documents>
  <module moduleId="1" name="C:\tfsdata\FilePointer\bin\UITest.dll" assembly="UITest" assemblyIdentity="UITest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, processorArchitecture=x86" nid="0">
    <class name="UITest.UnitTest" signature="UITest.UnitTest" excluded="false" nid="0">
      <method name=".ctor" signature=".ctor() : void" excluded="false" instrumented="true" cc="1" vc="1" nid="0">
        <seqpnt vc="1" o="0" l="16" el="16" c="9" ec="26" ex="false" fl="65536" doc="1" nid="0" />
        <seqpnt vc="1" o="8" l="21" el="21" c="9" ec="10" ex="false" fl="65536" doc="1" nid="0" />
        <seqpnt vc="1" o="9" l="0" el="0" c="0" ec="0" ex="false" fl="131072" doc="1" nid="0" />
      </method>
      <method name="get_TestContext" signature="get_TestContext() : Microsoft.VisualStudio.TestTools.UnitTesting.TestContext" excluded="false" instrumented="false" cc="1" vc="0" nid="0">
        <seqpnt vc="0" o="1" l="33" el="33" c="17" ec="44" ex="false" fl="65536" doc="1" nid="0" />
        <seqpnt vc="0" o="A" l="34" el="34" c="13" ec="14" ex="false" fl="65536" doc="1" nid="0" />
        <seqpnt vc="0" o="B" l="0" el="0" c="0" ec="0" ex="false" fl="131072" doc="1" nid="0" />
      </method>
      <method name="set_TestContext" signature="set_TestContext(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext value) : void" excluded="false" instrumented="false" cc="1" vc="0" nid="0">
        <seqpnt vc="0" o="1" l="37" el="37" c="17" ec="45" ex="false" fl="65536" doc="1" nid="0" />
        <seqpnt vc="0" o="8" l="0" el="0" c="0" ec="0" ex="false" fl="131072" doc="1" nid="0" />
        <seqpnt vc="0" o="8" l="38" el="38" c="13" ec="14" ex="false" fl="65536" doc="1" nid="0" />
      </method>
      <method name="TestMethod1" signature="TestMethod1() : void" excluded="false" instrumented="true" cc="1" vc="1" nid="0">
        <seqpnt vc="1" o="1" l="0" el="0" c="0" ec="0" ex="false" fl="131072" doc="1" nid="0" />
        <seqpnt vc="1" o="1" l="69" el="69" c="9" ec="10" ex="false" fl="65536" doc="1" nid="0" />
      </method>
    </class>
  </module>
</coverage>
Mike
  • 11
  • 1
  • 3

1 Answers1

0

Sonar works well with Gallio + NCover, you just need to clean your sonar-project.properties file, as some parameters are not properly set (see http://docs.codehaus.org/display/SONAR/sonar-csharp-gallio-plugin)

  • you should have only 1 "sonar.donet.visualstudio.testProjectPattern" property (should be something like "sonar.donet.visualstudio.testProjectPattern=Test"). The plugin does not support more than one.
  • the value of "sonar.gendarme.assemblies" looks strange to me: you should remove it for now
  • what kind of files does Gallio look for then when this is run from within sonar-runner? it's the VS project files or .cs files right? – Mike May 11 '12 at 06:24
  • Both are used to determine what the C# plugins must do. – Fabrice - SonarSource Team May 11 '12 at 06:44
  • ok, have addapted the pattern more drastically , one line and have the pattern *est* , which seems to work, so one step closer now. but ... now the coverage.xml file is empty :-( ... very strange, because when running everything through the gui it gets created well. Any tips on that? BTW is there, by any chance, any GOOD documentation which describes all elements working together? – Mike May 11 '12 at 06:59
  • You can contribute documentation back to the project if you feel that it's not good enough, this is an open-source project. Concerning the fact that the coverage file is empty, this may mean that the tests haven't been successfully executed, have they? – Fabrice - SonarSource Team May 11 '12 at 07:43
  • they have executed succesfull (so states the run and the sonar dashboard) – Mike May 11 '12 at 08:32
  • this is the sonar-runner coverage : – Mike May 11 '12 at 08:42
  • i've added it in the original post – Mike May 11 '12 at 08:50
  • http://docs.codehaus.org/display/SONAR/Advanced+parameters needs to list all available permutations of sonar.*.reportsPath – oers May 11 '12 at 08:54
  • Mike, to be sure: can you grab our Example project (http://svn.codehaus.org/sonar-plugins/trunk/dotnet/tools/dotnet-tools-commons/src/test/resources/solution/Example/), add just "sonar.gallio.coverage.tool=NCover" and "sonar.NCover.installDirectory=c:/Program Files(x86)/NCover" to your project properties file, and run Sonar please? This should work (and hopefully you could see what's happening on your side). – Fabrice - SonarSource Team May 11 '12 at 09:03
  • Fabrice: the sample project worked, i'e tried minimizing the properties file to the same level as it is in the sample app and still no luck: the coveragefile stays empty.... and I should be having at least 1.3% in sonar (sonar does state tests 100% successful though) – Mike May 11 '12 at 14:05
  • If you can reproduce it on a sample application, then the best is to send a mail on the Sonar user mailing list, and I'll be there to get your sample app and try to see what's happening. – Fabrice - SonarSource Team May 12 '12 at 16:49