Skip to main content

Featured

Java Interview Questions for Senior Full Stack Developer

Subscribe to our YouTube Channel to know interview questions

Part 3 - Find Code Coverage in Eclipse : EclEmma Configuration


What have we learned so far

1. Sonar Server Configuration
PART 1 : SETTING UP SONAR SERVER LOCALLY

2. Integrate JaCoCo plugin with Sonar and Maven for Code Coverage.
PART 2 - INTEGRATE JACOCO PLUGIN WITH SONAR AND MAVEN FOR CODE COVERAGE

EclEmma Configuration in Eclipse
How to find out the code coverage in eclipse?
Many time we want to find out the code coverage of our files before pushing the code into git repository. Till now we saw that Sonar can tell use the overall code coverage percentage and file wise code coverage. But what if I want to calculate it before moving the code to git repo?
We can do this by using EclEmma plugin in Eclipse. It brings code coverage analysis directly into the Eclipse workbench.

Please follow below steps to configure EclEmma in Eclipse.

Step 1: From your Eclipse menu select HelpEclipse Marketplace.

Step 2. Search for "EclEmma".

Step 3. Hit Install for the entry "EclEmma Java Code Coverage".

Step 4. Follow the steps in the installation wizard.

Once you complete the installation, you will be able to see a new menu Coverage As for each project or Java file.



To calculate the code coverage, click on Coverage As and then JUnit Test.
This will give us the code coverage in Eclipse under the Coverage dialog box as shown below.



We can also check the code coverage percentage of each file as below.


Source lines containing executable code get the following color code:


  • green for fully covered lines,
  • yellow for partly covered lines (some instructions or branches missed) and
  • red for lines that have not been executed at all.

Comments

Trending Tutorials

Trending Tutorials

WebSocket With Spring Boot and Angular 6 Tutorial

In this tutorial, we will understand What is WebSocket? Why to use WebSocket? Polling vs Server Sent Events vs WebSocket and WebSocket Example with Spring Boot + Angular 6 + STOMP

Code Coverage with JaCoCo Sonar and Maven

In this tutorial, we will understand the importance of code coverage and how can we setup the Sonar + JaCoCo + Maven to get the code coverage. We will look into Setting up Sonar Server Locally, Integrate JaCoCo plugin with Sonar and Maven for Code Coverage, Find Code Coverage in Eclipse : EclEmma Configuration

Java 8 Features

Learn all about Java 8 features in details

Lambda Expression in Java 8

Ever wonder what Lambda Expression is? What Lambda expressions are compiled to? if no then you should go through this tutorial to know more about Lambda and how they are different than anonymous class.

Popular Posts