How does the Sonar Runner upload the JUnit test results?

2,084 views
Skip to first unread message

julian...@gmail.com

unread,
Jan 19, 2017, 5:56:19 AM1/19/17
to SonarQube
Hi Everyone, 

I've been using using sonar at work on a large project with a large number of developers for over two years. I'm on sonar server 5.5. I'm really thankful for the help this community has provided in the past. 

What I'm seeing is that the sonar runner has stopped uploading the durations of the JUnit runs. (I'm not sure why). 

I imagine the sonar runner hoovers over the result files of the JUnit runs - but I'm not sure how this integration works. 

(This appears to have the effect of this report having no data)
http://server/component_measures/metric/test_execution_time/list?id=com.org%3Aproject

My question is: How does the Sonar Runner upload the JUnit test results?

Cheers
Julian

G. Ann Campbell

unread,
Jan 19, 2017, 6:57:05 AM1/19/17
to SonarQube, julian...@gmail.com
Hi Julian,

Test execution data is read based on your analysis configuration. Are you sure you're still producing test execution reports? To the same paths as before? Anything relevant to this in your analysis logs?


Ann

julian...@gmail.com

unread,
Jan 20, 2017, 10:28:01 PM1/20/17
to SonarQube, julian...@gmail.com
Hi Ann, 

Thanks for this - I got this fixed. (Assuming you're using sonar-scanner 2.5 and sonarqube 5.5)

What I learned:

sonar.sources - this needs to point to the top level directory where your package hierarchy for code starts - for a maven project this is:
src/main/java

sonar.tests - this needs to point to the top level directory where your package hierarchy for test code starts - for a maven project is this is:
src/test/java

sonar.test.exclusions - this needs to be set to blank or no test information will be uploaded - if you want to exclude issues from tests then use sonar.exclusions=...,**/src/test/**/*.java

Set the file upload path with sonar.junit.reportsPath=target/surefire-reports

Once you had sorted out the combination of these five settings - then it worked. 


Cheers
Julian
Reply all
Reply to author
Forward
0 new messages