Reputation: 5106
I have a project built with maven and I recently integrated Sonar... It is really easy to configure Sonar to analyze you're project but I couldn't configure it to run my project unit test also. I tried something with Jacoco but I get some Seam error and all the other tests are skipped. By the way I'm using TestNG to run tests manually.
Upvotes: 4
Views: 17041
Reputation: 701
Sonar cannot run tests, it can only analyze testing reports.
You can run yourself JUnit ( using Maven or Ant for exemple ) and push reports to Sonar (try Sonar's Maven plugin for that)
or you can give yourself a build factory (try hudson for exemple) and plug it to sonar.
Upvotes: 2
Reputation: 52665
You can use the relevant Analysis Parameters of sonar to reuse the test reports from your earlier run. You would set sonar.dynamicAnalysis
property to reuseReports
and specify the location of the reports in sonar.jacoco.reportPath
or sonar.surefire.reportPath
based on how you run the tests.
By the way, mvn sonar:sonar
invokes maven's test
goal, which runs unit tests as part of the analysis. So ideally if your maven can run unit tests, sonar should be able to run them.
Upvotes: 4