Sonar doesn't show number of unit test

2,918 views
Skip to first unread message

Ted Kossoko

unread,
Aug 3, 2017, 10:59:19 AM8/3/17
to SonarQube
Hi everybody. I use sonar for my Java and PHP projects. For my php project everything is ok. But for my java project sonar doesn't shop up the number of unit test nor the percentage, duration and others.
I have the coverage percentage and on jenkins, I have the number of tests.

Please how could I correct it ?

My jenkins build log :

INFO: Java Test Files AST scan (done) | time=1ms
INFO
: Sensor JavaSquidSensor [java] (done) | time=92373ms
INFO
: Sensor Analyzer for "php.ini" files [php]
INFO
: 0/0 source files have been analyzed
INFO
: Sensor Analyzer for "php.ini" files [php] (done) | time=6ms
INFO
: Sensor SurefireSensor [java]
INFO
: parsing [/home/ic/.jenkins/workspace/GenoLIMS/target/surefire-reports]
INFO
: Sensor SurefireSensor [java] (done) | time=2ms
INFO
: Sensor JaCoCoSensor [java]
INFO
: JaCoCo report not found: '/home/ic/.jenkins/workspace/GenoLIMS/genolims-site/coverage-reports/jacoco.exec'
INFO
: JaCoCo report not found: '/home/ic/.jenkins/workspace/GenoLIMS/genolims-ws2/coverage-reports/jacoco.exec'
INFO
: Analysing /home/ic/.jenkins/workspace/GenoLIMS/genolims-ws/coverage-reports/jacoco.exec
INFO
: Analysing /home/ic/.jenkins/workspace/GenoLIMS/genolims-echange/coverage-reports/jacoco.exec
INFO
: Analysing /home/ic/.jenkins/workspace/GenoLIMS/genolims-report/coverage-reports/jacoco.exec
INFO
: Analysing /home/ic/.jenkins/workspace/GenoLIMS/genolims-admin/coverage-reports/jacoco.exec
INFO
: Analysing /home/ic/.jenkins/workspace/GenoLIMS/genolims-common/coverage-reports/jacoco.exec
INFO
: Analysing /home/ic/.jenkins/workspace/GenoLIMS/genolims-war/coverage-reports/jacoco.exec
INFO
: Analysing /home/ic/.jenkins/workspace/GenoLIMS/genolims-svc/coverage-reports/jacoco.exec
INFO
: Analysing /home/ic/.jenkins/workspace/GenoLIMS/.scannerwork/jacoco-merged.exec
INFO
: No information about coverage per test.
INFO
: Sensor JaCoCoSensor [java] (done) | time=394ms
INFO
: Sensor SonarJavaXmlFileSensor [java]
INFO
: Sensor SonarJavaXmlFileSensor [java] (done) | time=2ms
INFO
: Sensor Zero Coverage Sensor
INFO
: Sensor Zero Coverage Sensor (done) | time=231ms
INFO
: Sensor CPD Block Indexer
INFO
: Sensor CPD Block Indexer (done) | time=1046ms
INFO
: SCM Publisher is disabled
INFO
: 171 files had no CPD blocks
INFO
: Calculating CPD for 817 files

My sonar properties :


# Métadonnées du projet.



sonar
.projectKey=sonar.genolims.ic

sonar
.projectName=GenoLIMS

sonar
.projectVersion=1.0


# Chemin vers les sources (obligatoire).

sonar
.sources=/home/ic/.jenkins/workspace/GenoLIMS/genolims,/home/ic/.jenkins/workspace/GenoLIMS/genolims-admin,/home/ic/.jenkins/workspace/GenoLIMS/genolims-common,/home/ic/.jenkins/workspace/GenoLIMS/genolims-echange,/home/ic/.jenkins/workspace/GenoLIMS/genolims-pda,/home/ic/.jenkins/workspace/GenoLIMS/genolims-report,/home/ic/.jenkins/workspace/GenoLIMS/genolims-svc,/home/ic/.jenkins/workspace/GenoLIMS/genolims-uml,/home/ic/.jenkins/workspace/GenoLIMS/genolims-ws,/home/ic/.jenkins/workspace/GenoLIMS/genolims-ws2



#sonar.exclusions=/home/ic/.jenkins/workspace/GenoLIMS/*.xml

#genolims-svc/src/test/java/fr/inra/sicnrgv/svc/**,

# Chemin vers les binaires du projet (optionnel).


sonar
.java.binaries=/home/ic/.jenkins/workspace/GenoLIMS/genolims-svc/target/classes


# Chemin vers les librairies du projet (optionnel).

#libraries=junit.jar


# Décommenter ces lignes si le projet utilise des spécificités de Java 1.5 ou 1.6

sonar
.java.source=1.6

sonar
.java.target=1.6


# Paramètres avancés, spécifiques au projet.

#my.property=value


#Tells SonarQube where the unit tests execution reports are

sonar
.junit.reportsPaths=genolims-svc/target/surefire-reports/


#Tells SonarQube where the unit tests code coverage report is

#sonar.dynamicAnalysis=reuseReports

sonar
.java.coveragePlugin=jacoco

sonar
.jacoco.reportPaths=/home/ic/.jenkins/workspace/GenoLIMS/genolims-svc/coverage-reports/jacoco.exec,/home/ic/.jenkins/workspace/GenoLIMS/genolims-ws/coverage-reports/jacoco.exec,/home/ic/.jenkins/workspace/GenoLIMS/genolims-admin/coverage-reports/jacoco.exec,/home/ic/.jenkins/workspace/GenoLIMS/genolims-common/coverage-reports/jacoco.exec,/home/ic/.jenkins/workspace/GenoLIMS/genolims-echange/coverage-reports/jacoco.exec,/home/ic/.jenkins/workspace/GenoLIMS/genolims-report/coverage-reports/jacoco.exec,/home/ic/.jenkins/workspace/GenoLIMS/genolims-site/coverage-reports/jacoco.exec,/home/ic/.jenkins/workspace/GenoLIMS/genolims-war/coverage-reports/jacoco.exec,/home/ic/.jenkins/workspace/GenoLIMS/genolims-ws2/coverage-reports/jacoco.exec





sonar
.language=java

sonar
.lang.patterns.xml : **/*.xml




# Encoding of the source files

sonar.sourceEncoding=UTF-8

How could I do please ?


G. Ann Campbell

unread,
Aug 3, 2017, 11:24:43 AM8/3/17
to SonarQube
Hi,

There are several things I find odd here. 

First, you have "target" in some of your paths, which implies a Maven project, yet you've provided the contents of a sonar-project.properties file, implying a SonarQube Scanner (non-Maven) analysis. Your life would probably be simpler if you just used the SonaQube Scanner for Maven (mvn sonar:sonar) but okay...

Second, your paths seem to be from box root. Typically you should list paths from project/analysis root, so presumably
GenoLIMS/genolims
instead of
/home/ic/.jenkins/workspace/GenoLIMS/genolims
But that part seems to be working for you, so okay...

And finally, while all your other properties list files from box root, your test execution report path is from analysis root. If path-from-box-root is working for everything else, it seems that it should work here too.


Ann

Ted Kossoko

unread,
Aug 3, 2017, 12:07:04 PM8/3/17
to SonarQube
Yes, I start with sonar so it's normal this weird configuration, but everything works fine.

Fo the units tests is it possible to directly in sonar to configure the path to the tests ? Because I tried many solutions without success

I downloaded the version 5.6. Very very good work. Thanks a lot

G. Ann Campbell

unread,
Aug 3, 2017, 12:28:07 PM8/3/17
to Ted Kossoko, SonarQube
Hi,

(Standard kvetch about missing courtesies...)

This is something you have to set on the analysis side.


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/NjQxlCgOkHY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/5b8bc07a-a37a-4405-b74c-ee6e19a08c44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ted Kossoko

unread,
Aug 4, 2017, 4:40:44 AM8/4/17
to SonarQube, kost...@gmail.com
Thanks for your previous answer.

Please, I'm wondering if sonar doesn't show up the tests units because I don't use sonar.tests property. Am I oblige to tell to sonar where the tests are ?

Thanks in advance for your answer.


G. Ann Campbell

unread,
Aug 4, 2017, 5:58:51 AM8/4/17
to Ted Kossoko, SonarQube
Hi Ted,

Yes, SonarQube can't tell you much about tests until you first tell it, using sonar.tests


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/NjQxlCgOkHY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages