4

I have installed SonarQube on my local development machine by following installation guide:

SonarQube Installation Guide for Existing TFS Environment.pdf.

The build is succesfull. The project is added to the dashboard. But there was only testcoverage data.

I have 4 projects in my solution, 2 of them are unittest projects. The build for SonarQube logs that there are found 4 test projects and no product projects:

SonarQube Analysis Summary
Analysis succeeded for SonarQube project "ConsoleApplication", version 1.0 (Analysis results)
  Product projects: 0, test projects: 4
  Invalid projects: 0, skipped projects: 0, excluded projects: 0

As far as I can see and have checked I have followed the manual on every point. Is there any setting that I have missed and results in zero product projects?

Pascal Berger
  • 4,262
  • 2
  • 30
  • 54
Pascal Naber
  • 1,092
  • 8
  • 14

1 Answers1

4

Turns out that the MsBuild runner looks at the full path of your project to see if it's a Test project. so if your Build agent name or Build definition name or any folder leading up to your project file has the word "test" in it, all projects will be considered a test.

As discussed offline, in your case it was the Build Definition name. Renaming it to not be named "SonarQubeTestBuild" solved the issue.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • 1
    Note that there is a configurable regexp property that you can change to tune how you want tests projects to be detected: `sonar.cs.msbuild.testProjectPattern`, whose default value indeed is simply `.*test.*` – Dinesh Bolkensteyn Jun 17 '15 at 13:15
  • Found that. In this case `.*/[^/]*Tests[^/]*\.[^/]*$` would have made sense for us. The default behavior is a bit weird, it would be nice if any path that's not in the solution directory or the would be excluded by default. – jessehouwing Jun 18 '15 at 19:58
  • where is that property? I mean which file holds that property? – XtianGIS Jan 29 '16 at 22:14