问题
We are running SonarQube(5.0.1), with sonar.net-runner on a TFS (2010) team build.
FxCop works fine, and everything runs perfect, I see all the issues in sonar.
However, when I try to pull in the test results in sonar, I run into an issue.
When I set the property sonar.cs.vstest.reportsPaths
to an absolute file of a trx
file, it publishes my test results to sonar. Great.
But when I use a wild card, my test results don't get published in sonar. Not so great
Configurations I've tried.
#1
sonar.cs.vstest.reportsPaths=E:/Builds/1/74/TestResults/*.trx
#2
sonar.cs.vstest.reportsPaths=TestResults/*.trx
#3
sonar.cs.vstest.reportsPaths=**/*.trx
#4
sonar.cs.vstest.reportsPaths=.**/*.trx
Full configuration
# ----- Project identification
sonar.projectVersion=2.6.0.0914
sonar.projectName=MySolution
sonar.projectKey=Company:MySolution
# ----- Use UTF-8 encoding, otherwise analysis is unable to read files
sonar.sourceEncoding=UTF-8
# ----- Visual studio bootstrapper
# Enable the Visual Studio bootstrapper
sonar.visualstudio.enable=true
#Define the solution to run sonar against
sonar.visualstudio.solution=MySolution.sln
#Specify the pattern of the test projects
sonar.visualstudio.testProjectPattern=.*Test*.
#We are using custom output paths.
sonar.visualstudio.outputPaths=E:/Builds/1/74/Binaries
# ----- FxCop
sonar.cs.fxcop.aspnet=false
sonar.cs.fxcop.fxCopCmdPath=D:/Sonar.NET/FxCop/FxCopCmd.exe
# ----- Unit Test Results
sonar.cs.vstest.reportsPaths=.**/*.trx.
# This property is set because it is required by the SonarQube Runner.
# But it is not taken into account because the location of the source
# code is retrieved from the .sln and .csproj files.
sonar.sources=.
回答1:
When I specify full file name it works. For example, sonar.cs.vstest.reportsPaths=C:/MyTestSoln/TestResults/MyTest.trx
But it doesn't work when I try "sonar.cs.vstest.reportsPaths=TestResults/*.trx"
回答2:
You need to provide full path to .trx file.
sonar.cs.vstest.reportsPaths=../TestResults/TestResult.trx
来源:https://stackoverflow.com/questions/29140962/sonar-not-picking-up-the-visual-studio-test-report-paths