Reputation: 95
I have installed Sonar and configured it to analyze our (.NET) projects (using Sonar-Runner). Everything works great, except the tests (MsTest). I've googled around, spent quite some time just trying, but no success. Each time I run sonar-runner, I see the same line in the output:
Gallio won't execute as there are no test projects
I've even created a new solution with 2 projects:
TestProject
=> The 'main' project, has only 1 class TestProject.UnitTests
=> has some simple unit tests on the class in the TestProject
In my sonar.properties file for the solution I have the following line:
sonar.dotnet.visualstudio.testProjectPattern=*.UnitTests
Running the analysis, everything works fine and I get result, except again: "no test projects found."
Actually I've tried many things with this property, but none have been successful. I also tried with a direct path to the dll, with the property:
sonar.dotnet.test.assemblies=D:\\Projects\\TestProject\\TestProject.UnitTests\\bin\\Debug\\TestProject.UnitTests.dll
and some other paths (relative, etc), but still: No test projects found.
Is there anyone who has some experience with this and can help me out with this problem?
PS. When I run Gallio on it self, it works, tests get executed, etc. Also, the path to Gallio in the Sonar properties is correct.
Upvotes: 7
Views: 3580
Reputation: 146
According to the source code (thanks to grepcode.com) for the Sonar C-sharp plugin, a project qualifies as a test project if its assembly name matches the testProjectPattern, which defaults to "*.Tests". It can also be set in sonar-project.properties, like this:
sonar.donet.visualstudio.testProjectPattern=*.UnitTests
Note the spelling error (donet)...(!)
Upvotes: 11