Setting Up Sonar.
Sonar is a fantastic free tool which allows you to truly see your code quality.Instructions on the install can be found on the main Sonar site. It will take less than 5 minutes. http://docs.codehaus.org/display/SONAR/Install+Sonar
Configuring Sonar To Use Jacoco
For our example you will also need to change the default code quality settings.This will allow us to use Jacoco instead of Cobertura as our code coverage tool.
First you need to login as an administrator

The login and password are both admin

So now you need to configure Sonar to use the jacoco plugin.Click the 'Configuration' link.

This will give you a number of options.
Choose 'General Settings' and then 'Code Coverage' for the category.
Then enter 'jacoco' as the code coverage plugin and 'Save'

Configuring The Sonar Dashboard
To be able to see the integration test coverage statistics the standard dashboard needs to be changedYou can only do this once you have run the Maven build first
Once you have run the project for the first time you will see the following
You need to click on the project name 'categories-sonar' to get to the details page.
Go to sonar web interface and click on 'configure widgets'.

You can now see a list of all of the dashboard widgets.
Go to the 'Integration test Coverage' section and click 'Add Widget'.
You can now see the integration test coverage details on the main panel. Now you need to click on the integration-test blah.
No comments:
Post a Comment