|
Hi,
I am trying to set up Sonar so that code it can run unit tests. It seems to be analyzing the source code but does not run the unit tests. I have set below property in sonar-project.properties file.
In order for unit tests to run, do I need to set up code coverage too? Is there any other settings do I need to do to be able to run unit tests? Thanks, Jignesh |
|
Hi Jignesh,
The ability for Sonar to automatically execute unit tests and to compute code coverage is only available when using the Sonar Maven plugin. With the Sonar standalone runner, this feature is not available.
But as the sources of your project are located in the src/main/java directory, looks like your project is based on maven, so using this Sonar Maven plugin should be straightforward. Kind regards, Freddy
-----
Sonar for Continuous Inspection On Wed, Aug 22, 2012 at 11:58 PM, jignesh patel <[hidden email]> wrote: Hi, |
|
Hi Freddy,
I guess sonar standalone runner works best for me. Is there a way to execute unit tests and compute code coverage with sonar standalone runner? Thank you very much for your help.
Thanks, Jignesh On Wed, Aug 22, 2012 at 11:45 PM, Freddy Mallet <[hidden email]> wrote: Hi Jignesh, |
|
Hi Jignesh,
No that was my point, this is only possible with the Sonar Maven plugin. If your java project is not based on Maven this is your responsibility to generate such reports. Kind regards, Freddy
|
|
Hi Freddy,
I have generated both unit tests results and cobertura coverage report in XML. This is what I set in sonar-project.properties file :
sonar.dynamicAnalysis=reuseReports sonar.surefire.reportsPath=/Users/User1/Documents/tmp/surefire-reports sonar.core.codeCoveragePlugin=cobertura sonar.cobertura.reportPath=/Users/User1/Documents/tmp/Summary/coverage.xml
It shows unit tests results but does not show code coverage reports. ![]() Note: In logs I see that coverage.xml file is being parsed. 16:11:02.748 INFO p.PhasesTimeProfiler - Sensor CoberturaSensor... 16:11:02.749 INFO .p.c.CoberturaSensor - parsing /Users/User1/Documents/tmp/Summary/coverage.xml
16:11:03.374 INFO p.PhasesTimeProfiler - Sensor CoberturaSensor done: 626 ms 16:11:03.672 INFO p.PhasesTimeProfiler - Execute decorators... Any idea why does it not display code coverage report?
Thanks, Jignesh On Sun, Sep 9, 2012 at 1:01 PM, Freddy Mallet <[hidden email]> wrote: Hi Jignesh, |
|
Hi Jignesh, I can see only one explanation : the classes listed in the Cobertura report don't exist in the Sonar project. Could you send a full screenshot of your Sonar project dashboard ?
Kind regards
-----
Sonar for Continuous Inspection On Tue, Sep 11, 2012 at 1:22 AM, jignesh patel <[hidden email]> wrote: Hi Freddy, |
| Powered by Nabble | Edit this page |
