Last Updated: October 20, 2022

How to Install and Use EclEmma

In this tutorial, we will show you how Install and Use EclEmma.

EclEmma is a free Java code coverage tool. It brings code coverage analysis directly into the Eclipse workbench: Fast develop/test cycle: Launches from within the workbench like JUnit test runs can directly be analyzed for code coverage.

Pre-Requisite:

Steps:

1.Install EclEmma.
  1. Go to Help.

  2. Select Eclipse MarketPlace.

  3. Then Search for EclEmma on the MarketPlace.

  4. Select EclEmma Java Code Coverage.

  5. Click Install.

  6. Click on accept.

  7. Click Finish.

download-eclemma-screen1.png
Figure 1. Install EclEmma
accept-screen2.png
Figure 2. Install EclEmma

It will ask you to restart the IDE, Click Restart Now.

restart-screen3.png
Figure 3. Restart the IDE.
2.Open the JUnit Project.

Open Created JUnit Project.

junit-app-screen4.png
Figure 4. JUnit Project
3.Coverage As JUnit Test.

Run Project as Coverage :

  1. Right-click on the Project.

  2. Select Coverage As.

  3. Select JUnit Test.

After running the Coverage tool tab will appers as shown in the figure below.

coverage-as-screen5.png
Figure 5. Coverage tool

Extend the files as the figure below, it will show the percentage.

green as covered and red not, you can see the method which did not covered in the coverage test.
extended-coverage-screen6.png
Figure 6. Coverage tool

Let’s see the method which did not get covered its "testAddWrongNumbers" method, as shown below figure, The green code shows that method covered, the red did not get covered.

you have total coverage 73.5% ,and for the AppTest.java 66.7%, 0.0% for "testAddWrongNumbers" method, and 100% for App.java .

That is How to Install and Use EclEmma, Enjoy.


The End