Closed BillHodghead closed 6 years ago
I haven't yet tried release 7.0.
There is the following error message in the log:
WARN: File not found /root/example/outyet/main_test.go
Are you using docker to run the analysis?
Not on docker. Just an Ubuntu VM. The code itself is a simple example: https://github.com/golang/example/tree/master/outyet. That file main_test.go does exist at that location.
That said, the test file is excluded from source and is only used for test scanning. What's missing is import of results from test.xml (included above).
I changed the sonar-project.properties file to
sonar.test.reportPath=./test.xml
sonar.sources=./
sonar.tests=./
sonar.test.inclusions=**/**_test.go
sonar.sources.inclusions=**/**.go
as mentioned in the release notes. This seems to give warnings that indicate the test file is being read, but nothing is showing up on the server for unit tests. Are there unit test attributes that are required and not being created by go test -v ./... | go-junit-report > test.xml
?
WARN: /root/example/outyet/main_test.go
WARN: Metric[id=<null>,key=skipped_tests,description=Number of skipped unit tests,type=INT,direction=-1,domain=Coverage,name=Skipped Unit Tests,qualitative=true,userManaged=false,enabled=true,worstValue=<null>,bestValue=0.0,optimizedBestValue=true,hidden=false,deleteHistoricalData=false,decimalScale=<null>]
WARN: /root/example/outyet/main_test.go
WARN: Metric[id=<null>,key=tests,description=Number of unit tests,type=INT,direction=-1,domain=Coverage,name=Unit Tests,qualitative=false,userManaged=false,enabled=true,worstValue=<null>,bestValue=<null>,optimizedBestValue=false,hidden=false,deleteHistoricalData=false,decimalScale=<null>]
WARN: /root/example/outyet/main_test.go
WARN: Metric[id=<null>,key=test_failures,description=Number of unit test failures,type=INT,direction=-1,domain=Coverage,name=Unit Test Failures,qualitative=true,userManaged=false,enabled=true,worstValue=<null>,bestValue=0.0,optimizedBestValue=true,hidden=false,deleteHistoricalData=false,decimalScale=<null>]
WARN: /root/example/outyet/main_test.go
WARN: Metric[id=<null>,key=test_execution_time,description=Execution duration of unit tests,type=MILLISEC,direction=-1,domain=Coverage,name=Unit Test Duration,qualitative=false,userManaged=false,enabled=true,worstValue=<null>,bestValue=<null>,optimizedBestValue=false,hidden=false,deleteHistoricalData=false,decimalScale=<null>]
INFO: Sensor Go test JUnit loader sensor [golang] (done) | time=30ms
INFO: Sensor Go Highlighter Sensor [golang]
INFO: Sensor Go Highlighter Sensor [golang] (done) | time=104ms
INFO: Sensor Go Metrics Sensor [golang]
INFO: Sensor Go Metrics Sensor [golang] (done) | time=5ms
Could you add
sonar.sources.exclusions=**/**_test.go
in sonar-project.properties?
Hi all, I test the project with sonarqube 6.3. I have no problem. I will explore the problem with sonarqube 7.0.
We dropped back to 6.x and got everything to work. That might not have been needed. The exclusion above certainly helped and also using sed to replace the absolute paths in the coverage file with relative paths. Thanks so much for your help.
I have test the projet with Sonarqube 7.0 and it's work.
sonar.test.reportPath=./test.xml
sonar.sources=./
sonar.tests=./
sonar.test.inclusions=**/**_test.go
sonar.sources.exclusions=**/**_test.go
sonar.sources.inclusions=**/**.go
sonar.projectKey=testIssue64
sonar.projectName=issue64
sonar.login=....
@bhcrosslake Could you close this issue if the problem is resolved ?
Description
Does the plugin work in SonarQube 7.0? I haven't yet dropped back to 6.x Although the unit test information appears to import, nothing appears in SonarQube to show the unit test status or failures and no rule is triggered for the unit test failure
Steps to Reproduce
Content of your sonar-project.properties
Log of sonar-scanner related to the plugin
Versions
SonarQube 7.0 Plugin 1.2.11
Additional Information
Test.xml