Junit: Jacoco Code Coverage Plugin Integration with Eclipse/STS


In previous post you learn about the Junit Code Coverage Report generation by using Maven POM.xml that’s help to generate report for auditing purpose and check the status of junit test case implementation but everytime for these report you have to visit directory target/site/jacoco/index.html or target/jacoco-report/index.html

To reduce this effort, we can add this Jacoco plugin our eclipse/STS IDE and directly check the status over IDE.

Integration of JACOCO Code Coverage Plugin in Eclipse/STS

You can follow these steps to integrate this JACOCO code coverage plug in you eclipse or STS IDE.

  • Go to IDE top header Help->Eclipse Market Place it will open the pop up for Eclipse Market Place.
  • Type text as “Code Coverage” in search text box and click “Go” button. You will get below screen
JACOCO Code Coverage Plugin for Eclipse/STS
  • You will get list of plugins select the plugin “EclEmma Code Coverage” click on Install button for this plugin.
  • You will get next screen where need to accept terms and conditions and click continue.
  • After installing this code coverage plugin, It will ask to restart your IDE.
  • After restart your IDE, go to the top Windows->Show View->Others then search for “Coverage” as below then select option click on Open button.
  • You will see one additional tab “Coverage” on your console view section as below.
Coverage tab on view
  • Also get “Coverage As” option as below when right click on your application. Now you can run you Junit.
JACOCO coverage as option
  • Once you run your application Junit by using “Coverage As” option you will see the results on “Coverage” tab as below.
JUnit Code coverage report by Eclipse/STS plugin

To learn more detail about this report and metrics header you can follow this link Junit: Code coverage by using JaCoCo.

Conclusion

In this topic you learn about the steps to add code coverage plugin in you eclipse/STS IDE.

If this port help you to add Code Coverage plugin in you eclipse/STS IDE the like this post and share your comments. In case you are facing issue related to code coverage implementation share with us will try to resolve it.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s