简体   繁体   English

Sonar&Gallio:由于没有测试项目,Gallio不会执行

[英]Sonar & Gallio: Gallio won't execute as there are no test projects

I have installed Sonar and configured it to analyze our (.NET) projects (using Sonar-Runner). 我已经安装了Sonar并将其配置为分析我们的(.NET)项目(使用Sonar-Runner)。 Everything works great, except the tests (MsTest). 除了测试(MsTest)之外,一切都很好。 I've googled around, spent quite some time just trying, but no success. 我已经google了一下,花了很长时间才尝试,但没有成功。 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: 我甚至创建了一个包含2个项目的新解决方案:

  • TestProject => The 'main' project, has only 1 class TestProject =>'main'项目,只有1个类
  • TestProject.UnitTests => has some simple unit tests on the class in the TestProject TestProject.UnitTests =>对TestProject的类进行了一些简单的单元测试

In my sonar.properties file for the solution I have the following line: 在我的sonar.properties文件中,解决方案我有以下几行:

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: 我也尝试了直接路径到dll,属性:

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. 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. 当我自己运行Gallio时,它可以运行,测试执行等等。此外,Sonar属性中Gallio的路径是正确的。

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". 根据Sonar C-sharp插件的源代码(感谢grepcode.com),如果项目的程序集名称与testProjectPattern匹配,则项目有资格作为测试项目,默认为“* .Tests”。 It can also be set in sonar-project.properties, like this: 它也可以在sonar-project.properties中设置,如下所示:

sonar.donet.visualstudio.testProjectPattern=*.UnitTests

Note the spelling error (donet)...(!) 注意拼写错误(donet)...(!)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM